diff --git a/src/osd/PG.cc b/src/osd/PG.cc index a26c951ac145b..173065e71d94d 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1696,7 +1696,7 @@ void PG::take_op_map_waiters() for (list::iterator i = waiting_for_map.begin(); i != waiting_for_map.end(); ) { - if (op_must_wait_for_map(get_osdmap_with_maplock(), *i)) { + if (op_must_wait_for_map(get_osdmap_with_maplock()->get_epoch(), *i)) { break; } else { osd->op_wq.queue(make_pair(PGRef(this), *i)); @@ -1713,7 +1713,7 @@ void PG::queue_op(OpRequestRef& op) waiting_for_map.push_back(op); return; } - if (op_must_wait_for_map(get_osdmap_with_maplock(), op)) { + if (op_must_wait_for_map(get_osdmap_with_maplock()->get_epoch(), op)) { waiting_for_map.push_back(op); return; } @@ -4868,67 +4868,67 @@ bool PG::can_discard_request(OpRequestRef& op) return true; } -bool PG::op_must_wait_for_map(OSDMapRef curmap, OpRequestRef op) +bool PG::op_must_wait_for_map(epoch_t cur_epoch, OpRequestRef& op) { switch (op->get_req()->get_type()) { case CEPH_MSG_OSD_OP: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->get_map_epoch()); case MSG_OSD_SUBOP: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_SUBOPREPLY: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_PG_SCAN: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_PG_BACKFILL: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_PG_PUSH: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_PG_PULL: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_PG_PUSH_REPLY: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_EC_WRITE: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_EC_WRITE_REPLY: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_EC_READ: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); case MSG_OSD_EC_READ_REPLY: return !have_same_or_newer_map( - curmap, + cur_epoch, static_cast(op->get_req())->map_epoch); } assert(0); diff --git a/src/osd/PG.h b/src/osd/PG.h index 0481a35ab8d69..40a379f971d8f 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2057,14 +2057,14 @@ class PG { template bool can_discard_replica_op(OpRequestRef& op); - static bool op_must_wait_for_map(OSDMapRef curmap, OpRequestRef op); + static bool op_must_wait_for_map(epoch_t cur_epoch, OpRequestRef& op); bool old_peering_msg(epoch_t reply_epoch, epoch_t query_epoch); bool old_peering_evt(CephPeeringEvtRef evt) { return old_peering_msg(evt->get_epoch_sent(), evt->get_epoch_requested()); } - static bool have_same_or_newer_map(OSDMapRef osdmap, epoch_t e) { - return e <= osdmap->get_epoch(); + static bool have_same_or_newer_map(epoch_t cur_epoch, epoch_t e) { + return e <= cur_epoch; } bool have_same_or_newer_map(epoch_t e) { return e <= get_osdmap()->get_epoch(); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 03e103a7f3a19..c45454446808c 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1081,7 +1081,7 @@ void ReplicatedPG::do_request( osd->reply_op_error(op, -EPERM); return; } - assert(!op_must_wait_for_map(get_osdmap(), op)); + assert(!op_must_wait_for_map(get_osdmap()->get_epoch(), op)); if (can_discard_request(op)) { return; }