From: Xuehan Xu Date: Sat, 11 May 2024 07:00:58 +0000 (+0800) Subject: crimson/osd/pg: hold PGs' references to the last minute of snap trim X-Git-Tag: testing/wip-jcollin-testing-20240625.102731-squid~74^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9cb0d62c7222a56e2a54dc67ec242b85cd040004;p=ceph-ci.git crimson/osd/pg: hold PGs' references to the last minute of snap trim events executions Fixes: https://tracker.ceph.com/issues/65972 Signed-off-by: Xuehan Xu (cherry picked from commit 1116c418b4fed0c8b6ab42d4f6c23cdc1afbef57) --- diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index ac7e2e4e317..02630d0b732 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -534,20 +534,22 @@ void PG::on_active_actmap() const auto needs_pause = !snap_trimq.empty(); return trim_snap(to_trim, needs_pause); } - ).finally([this] { + ).then_interruptible([this] { logger().debug("{}: PG::on_active_actmap() finished trimming", *this); peering_state.state_clear(PG_STATE_SNAPTRIM); peering_state.state_clear(PG_STATE_SNAPTRIM_ERROR); - publish_stats_to_osd(); + return seastar::now(); }); }, [this](std::exception_ptr eptr) { logger().debug("{}: snap trimming interrupted", *this); - peering_state.state_clear(PG_STATE_SNAPTRIM); - }, pg_ref); + ceph_assert(!peering_state.state_test(PG_STATE_SNAPTRIM)); + }, pg_ref).finally([pg_ref, this] { + publish_stats_to_osd(); + }); } else { logger().debug("{}: pg not clean, skipping snap trim"); - assert(!peering_state.state_test(PG_STATE_SNAPTRIM)); + ceph_assert(!peering_state.state_test(PG_STATE_SNAPTRIM)); } }