From 454a2b9285319d561046be0b482029f5130adfc7 Mon Sep 17 00:00:00 2001 From: Matan Breizman Date: Wed, 8 Nov 2023 13:07:29 +0000 Subject: [PATCH] crimson/osd/pg: extend pg lifetime on snap_trimq iteration Beacuse the loop's returned future is ignored, we should cover the scenario where the pg is removed and the snap_trimq iteration didn't complete yet. Fixes: https://tracker.ceph.com/issues/61653 Signed-off-by: Matan Breizman --- src/crimson/osd/pg.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 42052a4c84d..46daa402f81 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -471,6 +471,7 @@ void PG::on_active_actmap() logger().debug("{}: {} snap_trimq={}", *this, __func__, snap_trimq); peering_state.state_clear(PG_STATE_SNAPTRIM_ERROR); // loops until snap_trimq is empty or SNAPTRIM_ERROR. + Ref pg_ref = this; std::ignore = seastar::do_until( [this] { return snap_trimq.empty() || peering_state.state_test(PG_STATE_SNAPTRIM_ERROR); @@ -505,7 +506,7 @@ void PG::on_active_actmap() }).then([this, trimmed=to_trim] { logger().debug("{}: trimmed snap={}", *this, trimmed); }); - }).finally([this] { + }).finally([this, pg_ref] { logger().debug("{}: PG::on_active_actmap() finished trimming", *this); peering_state.state_clear(PG_STATE_SNAPTRIM); -- 2.39.5