From: Sage Weil Date: Thu, 16 Aug 2018 17:22:57 +0000 (-0500) Subject: osd: make project_pg_history handle concurrent osdmap publish X-Git-Tag: v14.0.1~371^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=cfe6ca82ed800e81e286396b5b7783ca299325f0;p=ceph.git osd: make project_pg_history handle concurrent osdmap publish The class's osdmap may be updated while we are in our loop. Pass it in explicitly instead. Fixes: http://tracker.ceph.com/issues/26970 Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 416714b7ddeb5..0e302c385fe33 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4370,18 +4370,19 @@ void OSD::build_initial_pg_history( * and same_primary_since. */ bool OSD::project_pg_history(spg_t pgid, pg_history_t& h, epoch_t from, + const OSDMap& endmap, const vector& currentup, int currentupprimary, const vector& currentacting, int currentactingprimary) { dout(15) << "project_pg_history " << pgid - << " from " << from << " to " << osdmap->get_epoch() + << " from " << from << " to " << endmap->get_epoch() << ", start " << h << dendl; epoch_t e; - for (e = osdmap->get_epoch(); + for (e = endmap->get_epoch(); e > from; e--) { // verify during intermediate epoch (e-1) @@ -4416,7 +4417,7 @@ bool OSD::project_pg_history(spg_t pgid, pg_history_t& h, epoch_t from, } // split? if (pgid.is_split(oldmap->get_pg_num(pgid.pool()), - osdmap->get_pg_num(pgid.pool()), + endmap->get_pg_num(pgid.pool()), 0) && e > h.same_interval_since) { h.same_interval_since = e; } @@ -9048,6 +9049,7 @@ void OSD::handle_pg_query_nopg(const MQuery& q) pg_history_t history = q.query.history; bool valid_history = project_pg_history( pgid, history, q.query.epoch_sent, + osdmap, up, up_primary, acting, acting_primary); if (!valid_history || diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 9d9ac42c333de..1e1e529a187e8 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1926,6 +1926,7 @@ protected: /// project pg history from from to now bool project_pg_history( spg_t pgid, pg_history_t& h, epoch_t from, + const OSDMap &osdmap, const vector& lastup, int lastupprimary, const vector& lastacting,