]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: add custom_reaction Backfilled and release reservations after backfill 22255/head
authorNeha Ojha <nojha@redhat.com>
Mon, 21 May 2018 19:34:31 +0000 (12:34 -0700)
committerNeha Ojha <nojha@redhat.com>
Sat, 26 May 2018 00:11:20 +0000 (17:11 -0700)
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 <nojha@redhat.com>
src/osd/PG.cc
src/osd/PG.h

index b915a6a4fdbca1dbd42ed98fcb8f981e053ea576..b88dc45bd4986f63172721ada191e6d01c62d210 100644 (file)
@@ -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<pg_shard_t>::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<Recovered>();
+}
+
 boost::statechart::result
 PG::RecoveryState::Backfilling::react(const DeferBackfill &c)
 {
index 7b4f26d25ed58dff6386c8c6479845464f4ee0da..083056dff825c2c49029a03205bac32542a74404 100644 (file)
@@ -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);