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: v12.2.10~42^2~1^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f512f905b140bfa9cc3241793e441de2c377e60b;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) Conflicts: src/osd/PG.cc src/osd/PG.h --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 95a9b7f64d2c..6581cc2988b9 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -6839,6 +6839,29 @@ PG::RecoveryState::Backfilling::Backfilling(my_context ctx) pg->publish_stats_to_osd(); } +boost::statechart::result +PG::RecoveryState::Backfilling::react(const Backfilled &c) +{ + 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) { + assert(*it != pg->pg_whoami); + ConnectionRef con = pg->osd->get_con_osd_cluster( + it->osd, pg->get_osdmap()->get_epoch()); + if (con) { + pg->osd->send_message_osd_cluster( + new MBackfillReserve( + MBackfillReserve::REJECT, + spg_t(pg->info.pgid.pgid, it->shard), + pg->get_osdmap()->get_epoch()), + con.get()); + } + } + return transit(); +} + boost::statechart::result PG::RecoveryState::Backfilling::react(const DeferBackfill &c) { @@ -6864,13 +6887,10 @@ PG::RecoveryState::Backfilling::react(const DeferBackfill &c) con.get()); } } - - if (!pg->waiting_on_backfill.empty()) { pg->waiting_on_backfill.clear(); pg->finish_recovery_op(hobject_t::get_max()); } - pg->schedule_backfill_retry(c.delay); return transit(); } diff --git a/src/osd/PG.h b/src/osd/PG.h index 212da4d7ed38..12bf9e977836 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2109,13 +2109,14 @@ 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 > > reactions; explicit Backfilling(my_context ctx); boost::statechart::result react(const RemoteReservationRejected& evt); + boost::statechart::result react(const Backfilled& evt); boost::statechart::result react(const DeferBackfill& evt); boost::statechart::result react(const UnfoundBackfill& evt); void exit();