]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: make project_pg_history handle concurrent osdmap publish 29976/head
authorSage Weil <sage@redhat.com>
Thu, 16 Aug 2018 17:22:57 +0000 (12:22 -0500)
committerDavid Zafman <dzafman@redhat.com>
Wed, 28 Aug 2019 17:49:48 +0000 (10:49 -0700)
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 <sage@redhat.com>
(cherry picked from commit cfe6ca82ed800e81e286396b5b7783ca299325f0)

Correction to this commit required because of separating it from very large pull request.
Needed to include part of 4bc01379bbf946d2f5963dcca6b071914117ce4a which
changed endmap from const OSDMap& to const OSDMapRef&.

src/osd/OSD.cc
src/osd/OSD.h

index 2a2cee1121dca3703cccb8f461dde0290aa1d3a7..e15bbdb51b11fff96e82ef5ba2b7fbf3f9baca83 100644 (file)
@@ -4205,18 +4205,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 OSDMapRef& endmap,
                             const vector<int>& currentup,
                             int currentupprimary,
                             const vector<int>& 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)
@@ -4251,7 +4252,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;
     }
@@ -8618,6 +8619,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 ||
index 1739c84e55f5fbf16424815f6054881e466a01ee..4aa9ae6aeb64ec6a3f00d2a52ea972d8f6525e42 100644 (file)
@@ -1878,6 +1878,7 @@ protected:
   /// project pg history from from to now
   bool project_pg_history(
     spg_t pgid, pg_history_t& h, epoch_t from,
+    const OSDMapRef& endmap,
     const vector<int>& lastup,
     int lastupprimary,
     const vector<int>& lastacting,