]> git.apps.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)
committerSage Weil <sage@redhat.com>
Tue, 12 Aug 2014 22:27:16 +0000 (15:27 -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>
(cherry picked from commit e179e9227b4a4482d8359682092fd7f426b9a919)

Conflicts:

src/osd/OSD.cc

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

index deca111dd10d81d7f169b2bed41f4b0ac7abb3ed..478669764b723b825746990da10cd3bba71629dd 100644 (file)
@@ -6137,11 +6137,28 @@ bool OSD::require_osd_peer(OpRequestRef& op)
   return true;
 }
 
+bool OSD::require_self_aliveness(OpRequestRef& op, epoch_t 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) ||
@@ -6185,8 +6202,7 @@ bool OSD::require_same_or_newer_map(OpRequestRef& op, epoch_t epoch)
     return false;
   }
 
-  if (epoch < up_epoch) {
-    dout(7) << "from pre-up epoch " << epoch << " < " << up_epoch << dendl;
+  if (!require_self_aliveness(op, epoch)) {
     return false;
   }
 
@@ -6206,12 +6222,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 efb3a0c460bd309e76aa0df5300678124fff5ef4..7729a7c791df08d05c090f50688fd8c8b4ed7116 100644 (file)
@@ -1514,6 +1514,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);