From: Neha Ojha Date: Mon, 21 May 2018 19:34:31 +0000 (-0700) Subject: PG: add custom_reaction Backfilled and release reservations after backfill X-Git-Tag: v13.2.1~109^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=71b82b5886af31ac5ca2ec20b201f6e0465e53a6;p=ceph.git PG: add custom_reaction Backfilled and release reservations after backfill After backfill completes, we directly go to the Recovered state without releasing reservations. The outstanding reservations cause double reservation issues. Creating a custom_reaction Backfilled, allows us to release reservations, before transiting to the Recovered state. Signed-off-by: Neha Ojha (cherry picked from commit 1abc2320283e9247bec7b0821a6134f31b9b5e29) --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 173a51902df..38235c766e6 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -7005,11 +7005,10 @@ PG::RecoveryState::Backfilling::Backfilling(my_context ctx) pg->publish_stats_to_osd(); } -void PG::RecoveryState::Backfilling::cancel_backfill() +void PG::RecoveryState::Backfilling::backfill_release_reservations() { PG *pg = context< RecoveryMachine >().pg; pg->osd->local_reserver.cancel_reservation(pg->info.pgid); - for (set::iterator it = pg->backfill_targets.begin(); it != pg->backfill_targets.end(); ++it) { @@ -7025,13 +7024,25 @@ void PG::RecoveryState::Backfilling::cancel_backfill() con.get()); } } +} +void PG::RecoveryState::Backfilling::cancel_backfill() +{ + PG *pg = context< RecoveryMachine >().pg; + backfill_release_reservations(); if (!pg->waiting_on_backfill.empty()) { pg->waiting_on_backfill.clear(); pg->finish_recovery_op(hobject_t::get_max()); } } +boost::statechart::result +PG::RecoveryState::Backfilling::react(const Backfilled &c) +{ + backfill_release_reservations(); + return transit(); +} + boost::statechart::result PG::RecoveryState::Backfilling::react(const DeferBackfill &c) { diff --git a/src/osd/PG.h b/src/osd/PG.h index 7b4f26d25ed..083056dff82 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2278,7 +2278,7 @@ protected: struct Backfilling : boost::statechart::state< Backfilling, Active >, NamedState { typedef boost::mpl::list< - boost::statechart::transition< Backfilled, Recovered >, + boost::statechart::custom_reaction< Backfilled >, boost::statechart::custom_reaction< DeferBackfill >, boost::statechart::custom_reaction< UnfoundBackfill >, boost::statechart::custom_reaction< RemoteReservationRejected >, @@ -2291,6 +2291,8 @@ protected: post_event(RemoteReservationRevokedTooFull()); return discard_event(); } + void backfill_release_reservations(); + boost::statechart::result react(const Backfilled& evt); boost::statechart::result react(const RemoteReservationRevokedTooFull& evt); boost::statechart::result react(const RemoteReservationRevoked& evt); boost::statechart::result react(const DeferBackfill& evt);