]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMonitor::prepare_pgtemp: only update up_thru if newer 10001/head
authorSamuel Just <sjust@redhat.com>
Wed, 8 Jun 2016 00:15:05 +0000 (17:15 -0700)
committerLoic Dachary <ldachary@redhat.com>
Wed, 29 Jun 2016 08:27:02 +0000 (10:27 +0200)
Fixes: http://tracker.ceph.com/issues/16185
Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit 5f2bd7b6b28aad96d68444b22c04b8b24564616b)

src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h

index 68bcc97639ebea3eeb918af5f566bbb50402dce9..f0555813bd877159f66b8f172498228a7e41a2eb 100644 (file)
@@ -2247,7 +2247,8 @@ bool OSDMonitor::prepare_alive(MonOpRequestRef op)
 
   dout(7) << "prepare_alive want up_thru " << m->want << " have " << m->version
          << " from " << m->get_orig_source_inst() << dendl;
-  pending_inc.new_up_thru[from] = m->version;  // set to the latest map the OSD has
+
+  update_up_thru(from, m->version); // set to the latest map the OSD has
   wait_for_finished_proposal(op, new C_ReplyMap(this, op, m->version));
   return true;
 }
@@ -2335,6 +2336,19 @@ bool OSDMonitor::preprocess_pgtemp(MonOpRequestRef op)
   return true;
 }
 
+void OSDMonitor::update_up_thru(int from, epoch_t up_thru)
+{
+  epoch_t old_up_thru = osdmap.get_up_thru(from);
+  auto ut = pending_inc.new_up_thru.find(from);
+  if (ut != pending_inc.new_up_thru.end()) {
+    old_up_thru = ut->second;
+  }
+  if (up_thru > old_up_thru) {
+    // set up_thru too, so the osd doesn't have to ask again
+    pending_inc.new_up_thru[from] = up_thru;
+  }
+}
+
 bool OSDMonitor::prepare_pgtemp(MonOpRequestRef op)
 {
   op->mark_osdmon_event(__func__);
@@ -2362,7 +2376,10 @@ bool OSDMonitor::prepare_pgtemp(MonOpRequestRef op)
        pending_inc.new_primary_temp.count(p->first))
       pending_inc.new_primary_temp[p->first] = -1;
   }
-  pending_inc.new_up_thru[from] = m->map_epoch;   // set up_thru too, so the osd doesn't have to ask again
+
+  // set up_thru too, so the osd doesn't have to ask again
+  update_up_thru(from, m->map_epoch);
+
   wait_for_finished_proposal(op, new C_ReplyMap(this, op, m->map_epoch));
   return true;
 }
index 9d4d33d239bf8f5fcb2c39c37e8e2ccd6a57d910..4fb1ba40838eb8f15796fe338cedd6a918b75b05 100644 (file)
@@ -257,6 +257,7 @@ private:
   bool prepare_boot(MonOpRequestRef op);
   void _booted(MonOpRequestRef op, bool logit);
 
+  void update_up_thru(int from, epoch_t up_thru);
   bool preprocess_alive(MonOpRequestRef op);
   bool prepare_alive(MonOpRequestRef op);
   void _reply_map(MonOpRequestRef op, epoch_t e);