]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: introduce require_self_aliveness(OpRequestRef&,epoch_t) function
authorGreg Farnum <greg@inktank.com>
Mon, 28 Jul 2014 21:19:59 +0000 (14:19 -0700)
committerGreg Farnum <greg@inktank.com>
Tue, 29 Jul 2014 01:39:59 +0000 (18:39 -0700)
Take the self-aliveness checks out of require_same_or_newer_map() and use
the new function for that and for require_up_osd_peer().

Signed-off-by: Greg Farnum <greg@inktank.com>
src/osd/OSD.cc
src/osd/OSD.h

index d3b648cb82524c82ecbe8049ac454908679ff422..911e903baf14bb38c178334e3b57e9181cc796b0 100644 (file)
@@ -6564,11 +6564,29 @@ bool OSD::require_osd_peer(OpRequestRef& op)
   return true;
 }
 
+bool OSD::require_self_aliveness(OpRequestRef& op, epoch_t epoch)
+{
+  epoch_t up_epoch = service.get_up_epoch();
+  if (epoch < up_epoch) {
+    dout(7) << "from pre-up epoch " << epoch << " < " << up_epoch << dendl;
+    return false;
+  }
+
+  if (!is_active()) {
+    dout(7) << "still in boot state, dropping message " << *op->get_req() << dendl;
+    return false;
+  }
+
+  return true;
+}
+
 bool OSD::require_up_osd_peer(OpRequestRef& op, OSDMapRef& map,
                               epoch_t their_epoch)
 {
   int from = op->get_req()->get_source().num();
-  if (!require_osd_peer(op)) {
+  if (!require_self_aliveness(op, their_epoch)) {
+    return false;
+  } else if (!require_osd_peer(op)) {
     return false;
   } else if (map->get_epoch() >= their_epoch &&
       (!map->have_inst(from) ||
@@ -6612,9 +6630,7 @@ bool OSD::require_same_or_newer_map(OpRequestRef& op, epoch_t epoch)
     return false;
   }
 
-  epoch_t up_epoch = service.get_up_epoch();
-  if (epoch < up_epoch) {
-    dout(7) << "from pre-up epoch " << epoch << " < " << up_epoch << dendl;
+  if (!require_self_aliveness(op, epoch)) {
     return false;
   }
 
@@ -6641,12 +6657,6 @@ bool OSD::require_same_or_newer_map(OpRequestRef& op, epoch_t epoch)
     }
   }
 
-  // ok, we have at least as new a map as they do.  are we (re)booting?
-  if (!is_active()) {
-    dout(7) << "still in boot state, dropping message " << *m << dendl;
-    return false;
-  }
-
   return true;
 }
 
index cc9c108a637a6a011d685495071805662456bab1..81158d04a6d68dd1897b90aa20294d63c43a327a 100644 (file)
@@ -1802,6 +1802,11 @@ protected:
 
   bool require_mon_peer(Message *m);
   bool require_osd_peer(OpRequestRef& op);
+  /***
+   * Verifies that we were alive in the given epoch, and that
+   * still are.
+   */
+  bool require_self_aliveness(OpRequestRef& op, epoch_t alive_since);
   bool require_up_osd_peer(OpRequestRef& Op, OSDMapRef& map,
                            epoch_t their_epoch);