From: Sage Weil Date: Wed, 4 Oct 2017 20:28:26 +0000 (-0500) Subject: osd/PG: separate event for RemoteReservationCanceled X-Git-Tag: v12.2.2~157^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=59a5a109040884dd2c7c77f3bc84378b54048f1d;p=ceph.git osd/PG: separate event for RemoteReservationCanceled Right now we transparently map a RemoteReservationRejected into a *Canceled event because this what peers send over the wire. Even once new peers start sending and explicit CANCEL, old peers will still do so, so we'll maintain this mapping for a while. Signed-off-by: Sage Weil (cherry picked from commit 84d71e6a10b02591b5d5e126b346771871eb1575) --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index d4a07ec828a8..23c7a251f523 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -6689,7 +6689,7 @@ PG::RecoveryState::RepWaitRecoveryReserved::react(const RemoteRecoveryReserved & boost::statechart::result PG::RecoveryState::RepWaitRecoveryReserved::react( - const RemoteReservationRejected &evt) + const RemoteReservationCanceled &evt) { PG *pg = context< RecoveryMachine >().pg; pg->osd->remote_reserver.cancel_reservation(pg->info.pgid); @@ -6787,7 +6787,17 @@ PG::RecoveryState::RepWaitBackfillReserved::react( } boost::statechart::result -PG::RecoveryState::RepWaitBackfillReserved::react(const RemoteReservationRejected &evt) +PG::RecoveryState::RepWaitBackfillReserved::react( + const RemoteReservationRejected &evt) +{ + PG *pg = context< RecoveryMachine >().pg; + pg->osd->remote_reserver.cancel_reservation(pg->info.pgid); + return transit(); +} + +boost::statechart::result +PG::RecoveryState::RepWaitBackfillReserved::react( + const RemoteReservationCanceled &evt) { PG *pg = context< RecoveryMachine >().pg; pg->osd->remote_reserver.cancel_reservation(pg->info.pgid); diff --git a/src/osd/PG.h b/src/osd/PG.h index 8e461fdf3139..fd5f36aec066 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1589,6 +1589,7 @@ public: TrivialEvent(RemoteBackfillReserved) TrivialEvent(RejectRemoteReservation) TrivialEvent(RemoteReservationRejected) + TrivialEvent(RemoteReservationCanceled) TrivialEvent(RequestBackfill) TrivialEvent(RequestRecovery) TrivialEvent(RecoveryDone) @@ -1986,7 +1987,9 @@ public: struct RepRecovering : boost::statechart::state< RepRecovering, ReplicaActive >, NamedState { typedef boost::mpl::list< boost::statechart::transition< RecoveryDone, RepNotRecovering >, + // for compat with old peers boost::statechart::transition< RemoteReservationRejected, RepNotRecovering >, + boost::statechart::transition< RemoteReservationCanceled, RepNotRecovering >, boost::statechart::custom_reaction< BackfillTooFull > > reactions; explicit RepRecovering(my_context ctx); @@ -1998,24 +2001,33 @@ public: typedef boost::mpl::list< boost::statechart::custom_reaction< RemoteBackfillReserved >, boost::statechart::custom_reaction< RejectRemoteReservation >, - boost::statechart::custom_reaction< RemoteReservationRejected > + boost::statechart::custom_reaction< RemoteReservationRejected >, + boost::statechart::custom_reaction< RemoteReservationCanceled > > reactions; explicit RepWaitBackfillReserved(my_context ctx); void exit(); boost::statechart::result react(const RemoteBackfillReserved &evt); boost::statechart::result react(const RejectRemoteReservation &evt); boost::statechart::result react(const RemoteReservationRejected &evt); + boost::statechart::result react(const RemoteReservationCanceled &evt); }; struct RepWaitRecoveryReserved : boost::statechart::state< RepWaitRecoveryReserved, ReplicaActive >, NamedState { typedef boost::mpl::list< boost::statechart::custom_reaction< RemoteRecoveryReserved >, - boost::statechart::custom_reaction< RemoteReservationRejected > + // for compat with old peers + boost::statechart::custom_reaction< RemoteReservationRejected >, + boost::statechart::custom_reaction< RemoteReservationCanceled > > reactions; explicit RepWaitRecoveryReserved(my_context ctx); void exit(); boost::statechart::result react(const RemoteRecoveryReserved &evt); - boost::statechart::result react(const RemoteReservationRejected &evt); + boost::statechart::result react(const RemoteReservationRejected &evt) { + // for compat with old peers + post_event(RemoteReservationCanceled()); + return discard_event(); + } + boost::statechart::result react(const RemoteReservationCanceled &evt); }; struct RepNotRecovering : boost::statechart::state< RepNotRecovering, ReplicaActive>, NamedState { @@ -2023,7 +2035,8 @@ public: boost::statechart::custom_reaction< RequestBackfillPrio >, boost::statechart::transition< RequestRecovery, RepWaitRecoveryReserved >, boost::statechart::custom_reaction< RejectRemoteReservation >, - boost::statechart::transition< RemoteReservationRejected, RepNotRecovering >, // if primary is preempted or cancels + boost::statechart::transition< RemoteReservationRejected, RepNotRecovering >, + boost::statechart::transition< RemoteReservationCanceled, RepNotRecovering >, boost::statechart::transition< RecoveryDone, RepNotRecovering > // for compat with pre-reservation peers > reactions; explicit RepNotRecovering(my_context ctx);