From: Greg Farnum Date: Mon, 28 Jul 2014 21:19:59 +0000 (-0700) Subject: OSD: introduce require_self_aliveness(OpRequestRef&,epoch_t) function X-Git-Tag: v0.80.6~81 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8595e9bed3689933c03a8f3443052a36ff1d62f5;p=ceph.git OSD: introduce require_self_aliveness(OpRequestRef&,epoch_t) function 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 (cherry picked from commit e179e9227b4a4482d8359682092fd7f426b9a919) Conflicts: src/osd/OSD.cc --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index deca111dd10d8..478669764b723 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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; } diff --git a/src/osd/OSD.h b/src/osd/OSD.h index efb3a0c460bd3..7729a7c791df0 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -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);