]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMonitor::prepare_pgtemp: only update up_thru if newer 9874/head
authorSamuel Just <sjust@redhat.com>
Wed, 8 Jun 2016 00:15:05 +0000 (17:15 -0700)
committerSamuel Just <sjust@redhat.com>
Wed, 8 Jun 2016 00:29:34 +0000 (17:29 -0700)
Fixes: http://tracker.ceph.com/issues/16185
Signed-off-by: Samuel Just <sjust@redhat.com>
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h

index c18583cb65d30cb5b121bf51dfa0df7b68a4dcc0..62bbb77ad259113e78a41f15847ef09207bd7a58 100644 (file)
@@ -2265,7 +2265,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;
 }
@@ -2353,6 +2354,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__);
@@ -2380,7 +2394,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 75d15944a5ca5d2c40d251c1540526c9d08f12c6..aff5b1bf83e6e9ed8f9427a717ccc2698a9196f3 100644 (file)
@@ -251,6 +251,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);