]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd/pg: extend pg lifetime on snap_trimq iteration
authorMatan Breizman <mbreizma@redhat.com>
Wed, 8 Nov 2023 13:07:29 +0000 (13:07 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Mon, 13 Nov 2023 16:05:36 +0000 (16:05 +0000)
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 <mbreizma@redhat.com>
src/crimson/osd/pg.cc

index 42052a4c84d9d9f0250a31bf25d01d3024e9fa42..46daa402f81fd425af10943b3930e85d10bbc3bc 100644 (file)
@@ -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> 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);