]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: make project_pg_history handle concurrent osdmap publish
authorSage Weil <sage@redhat.com>
Thu, 16 Aug 2018 17:22:57 +0000 (12:22 -0500)
committerSage Weil <sage@redhat.com>
Fri, 7 Sep 2018 17:09:42 +0000 (12:09 -0500)
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>
src/osd/OSD.cc
src/osd/OSD.h

index 416714b7ddeb52bb15d6b925edeb074a6072f8e8..0e302c385fe33fd33000449500e4bf1b96a41683 100644 (file)
@@ -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<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)
@@ -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 ||
index 9d9ac42c333deb487406bed3ab6dfbdaeb868662..1e1e529a187e8307623756556fae4a67869f0d39 100644 (file)
@@ -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<int>& lastup,
     int lastupprimary,
     const vector<int>& lastacting,