From 2c0741fcefc936947cf1d5a19b11f1e19e6bdf9f Mon Sep 17 00:00:00 2001 From: Xuehan Xu Date: Sat, 11 May 2024 15:01:54 +0800 Subject: [PATCH] crimson/osd/pg: clear PG_STATE_SNAPTRIM on interval changes This is to avoid the scenarios in which pgs get activated before PG_STATE_SNAPTRIM of the last pg interval gets cleared Signed-off-by: Xuehan Xu (cherry picked from commit 2c216b95ece4a0ec7ad723bdd2b00efce3135b2d) --- src/crimson/osd/pg.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 02630d0b732da..457c98cf402ca 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -1588,6 +1588,11 @@ void PG::on_change(ceph::os::Transaction &t) { } scrubber.on_interval_change(); obc_registry.invalidate_on_interval_change(); + // snap trim events are all going to be interrupted, + // clearing PG_STATE_SNAPTRIM/PG_STATE_SNAPTRIM_ERROR here + // is save and in time. + peering_state.state_clear(PG_STATE_SNAPTRIM); + peering_state.state_clear(PG_STATE_SNAPTRIM_ERROR); } void PG::context_registry_on_change() { -- 2.39.5