From ab8f1d291216c07fed7b661896b0a0c1279f50eb Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 1 Oct 2017 15:04:34 -0500 Subject: [PATCH] osd/PG: handle RecoveryReservationRejected in RepWaitRecoveryReserved This state is analogous to RepWaitBackfillReserved; just like we do there we want to handle the REJECT from the primary by canceling our local remote_reservation. Signed-off-by: Sage Weil --- src/osd/PG.cc | 9 +++++++++ src/osd/PG.h | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 338fd9a6d233c..08f4e2a72518d 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -6459,6 +6459,15 @@ PG::RecoveryState::RepWaitRecoveryReserved::react(const RemoteRecoveryReserved & return transit(); } +boost::statechart::result +PG::RecoveryState::RepWaitRecoveryReserved::react( + const RemoteReservationRejected &evt) +{ + PG *pg = context< RecoveryMachine >().pg; + pg->osd->remote_reserver.cancel_reservation(pg->info.pgid); + return transit(); +} + void PG::RecoveryState::RepWaitRecoveryReserved::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); diff --git a/src/osd/PG.h b/src/osd/PG.h index 02c52d7dc24f0..abaef117a8054 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2001,11 +2001,13 @@ class PG : public DoutPrefixProvider { struct RepWaitRecoveryReserved : boost::statechart::state< RepWaitRecoveryReserved, ReplicaActive >, NamedState { typedef boost::mpl::list< - boost::statechart::custom_reaction< RemoteRecoveryReserved > + boost::statechart::custom_reaction< RemoteRecoveryReserved >, + boost::statechart::custom_reaction< RemoteReservationRejected > > reactions; explicit RepWaitRecoveryReserved(my_context ctx); void exit(); boost::statechart::result react(const RemoteRecoveryReserved &evt); + boost::statechart::result react(const RemoteReservationRejected &evt); }; struct RepNotRecovering : boost::statechart::state< RepNotRecovering, ReplicaActive>, NamedState {