]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/pg: hold PGs' references to the last minute of snap trim
authorXuehan Xu <xuxuehan@qianxin.com>
Sat, 11 May 2024 07:00:58 +0000 (15:00 +0800)
committerMatan Breizman <mbreizma@redhat.com>
Thu, 13 Jun 2024 12:41:31 +0000 (15:41 +0300)
events executions

Fixes: https://tracker.ceph.com/issues/65972
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
(cherry picked from commit 1116c418b4fed0c8b6ab42d4f6c23cdc1afbef57)

src/crimson/osd/pg.cc

index ac7e2e4e31733ce27b87af3bba26a859f59d4619..02630d0b732da4a042f2fd9e34eb0a7886fb334e 100644 (file)
@@ -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));
   }
 }