From: Igor Fedotov Date: Wed, 30 Dec 2020 20:41:37 +0000 (+0300) Subject: osd/PG: fix no exit() call for PeeringState::Deleting state X-Git-Tag: v16.1.0~22^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a23488df4f16e4efb1a4c3edb70eea6849575ee2;p=ceph.git osd/PG: fix no exit() call for PeeringState::Deleting state Signed-off-by: Igor Fedotov --- diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index e9dd078de6c9..0f01c160783d 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -308,12 +308,12 @@ void PG::prepare_write(pg_info_t &info, } } -ghobject_t PG::do_delete_work(ceph::os::Transaction &t, - ghobject_t _next) +std::pair +PG::do_delete_work(ceph::os::Transaction &t, ghobject_t _next) { // TODO shard_services.dec_pg_num(); - return _next; + return {_next, false}; } void PG::scrub_requested(scrub_level_t scrub_level, scrub_type_t scrub_type) diff --git a/src/crimson/osd/pg.h b/src/crimson/osd/pg.h index 88d39fde9ad4..34676ee7a109 100644 --- a/src/crimson/osd/pg.h +++ b/src/crimson/osd/pg.h @@ -328,8 +328,8 @@ public: void on_removal(ceph::os::Transaction &t) final { // TODO } - ghobject_t do_delete_work(ceph::os::Transaction &t, - ghobject_t _next) final; + std::pair + do_delete_work(ceph::os::Transaction &t, ghobject_t _next) final; // merge/split not ready void clear_ready_to_merge() final {} diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 972a5482841a..19b9cc4956ba 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2606,8 +2606,9 @@ void PG::C_DeleteMore::complete(int r) { delete this; } -ghobject_t PG::do_delete_work(ObjectStore::Transaction &t, - ghobject_t _next) +std::pair PG::do_delete_work( + ObjectStore::Transaction &t, + ghobject_t _next) { dout(10) << __func__ << dendl; @@ -2633,7 +2634,7 @@ ghobject_t PG::do_delete_work(ObjectStore::Transaction &t, osd->sleep_timer.add_event_at(delete_schedule_time, delete_requeue_callback); dout(20) << __func__ << " Delete scheduled at " << delete_schedule_time << dendl; - return _next; + return std::make_pair(_next, true); } } @@ -2689,6 +2690,7 @@ ghobject_t PG::do_delete_work(ObjectStore::Transaction &t, t.remove(coll, oid); ++num; } + bool running = true; if (num) { dout(20) << __func__ << " deleting " << num << " objects" << dendl; Context *fin = new C_DeleteMore(this, get_osdmap_epoch()); @@ -2725,10 +2727,10 @@ ghobject_t PG::do_delete_work(ObjectStore::Transaction &t, // exit() methods don't run when that happens. osd->local_reserver.cancel_reservation(info.pgid); - osd->logger->dec(l_osd_pg_removing); + running = false; } } - return next; + return {next, running}; } int PG::pg_stat_adjust(osd_stat_t *ns) diff --git a/src/osd/PG.h b/src/osd/PG.h index a2403cc07d55..23aea62ba8b7 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -485,7 +485,7 @@ public: return std::make_unique(this, &t); } - ghobject_t do_delete_work(ObjectStore::Transaction &t, + std::pair do_delete_work(ObjectStore::Transaction &t, ghobject_t _next) override; void clear_ready_to_merge() override; diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 80208f1e7725..85c352303e36 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -6700,8 +6700,6 @@ PeeringState::Deleting::Deleting(my_context ctx) : my_base(ctx), NamedState(context< PeeringMachine >().state_history, "Started/ToDelete/Deleting") { - start = ceph::mono_clock::now(); - context< PeeringMachine >().log_enter(state_name); DECLARE_LOCALS; @@ -6724,9 +6722,11 @@ boost::statechart::result PeeringState::Deleting::react( const DeleteSome& evt) { DECLARE_LOCALS; - next = pl->do_delete_work(context().get_cur_transaction(), + std::pair p; + p = pl->do_delete_work(context().get_cur_transaction(), next); - return discard_event(); + next = p.first; + return p.second ? discard_event() : terminate(); } void PeeringState::Deleting::exit() @@ -6735,9 +6735,6 @@ void PeeringState::Deleting::exit() DECLARE_LOCALS; ps->deleting = false; pl->cancel_local_background_io_reservation(); - psdout(20) << "Deleting::" << __func__ << this <<" finished in " - << ceph::mono_clock::now() - start - << dendl; } /*--------GetInfo---------*/ diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index 98b8fc561c9a..1ae5073d1f37 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -377,8 +377,8 @@ public: /// Notification of removal complete, t must be populated to complete removal virtual void on_removal(ObjectStore::Transaction &t) = 0; /// Perform incremental removal work - virtual ghobject_t do_delete_work(ObjectStore::Transaction &t, - ghobject_t _next) = 0; + virtual std::pair do_delete_work( + ObjectStore::Transaction &t, ghobject_t _next) = 0; // ======================= PG Merge ========================= virtual void clear_ready_to_merge() = 0; @@ -1244,7 +1244,6 @@ public: boost::statechart::transition > reactions; ghobject_t next; - ceph::mono_clock::time_point start; explicit Deleting(my_context ctx); boost::statechart::result react(const DeleteSome &evt); void exit();