From 285901a7001d644f806fffef3d2296ba42a4ce49 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Wed, 8 Feb 2023 07:00:09 +0000 Subject: [PATCH] osd/scrubber: rename advance_token to reset_replica_state Also removes misleading comment -- because primaries may freely reset scrub, there may well be valid scrub state. Signed-off-by: Samuel Just --- src/osd/scrubber/pg_scrubber.cc | 12 +++--------- src/osd/scrubber/pg_scrubber.h | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index 42a89789b3c..f502482afc8 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -1600,7 +1600,7 @@ void PgScrubber::handle_scrub_reserve_request(OpRequestRef op) /* The primary may unilaterally restart the scrub process without notifying * replicas. Unconditionally clear any existing state prior to handling * the new reservation. */ - advance_token(); + reset_replica_state(); bool granted{false}; if (m_pg->cct->_conf->osd_scrub_during_recovery || @@ -1661,7 +1661,7 @@ void PgScrubber::handle_scrub_reserve_release(OpRequestRef op) * this specific scrub session has terminated. All incoming events carrying * the old tag will be discarded. */ - advance_token(); + reset_replica_state(); } void PgScrubber::discard_replica_reservations() @@ -2338,18 +2338,12 @@ void PgScrubber::reset_internal_state() m_be.reset(); } -// note that only applicable to the Replica: -void PgScrubber::advance_token() +void PgScrubber::reset_replica_state() { dout(10) << fmt::format("{}: prev. token:{}", __func__, m_current_token) << dendl; m_current_token++; - - // when advance_token() is called, it is assumed that no scrubbing takes - // place. We will, though, verify that. And if we are actually still handling - // a stale request - both our internal state and the FSM state will be - // cleared. m_remote_osd_resource.reset(); replica_handling_done(); m_fsm->process_event(FullReset{}); diff --git a/src/osd/scrubber/pg_scrubber.h b/src/osd/scrubber/pg_scrubber.h index f56643c0e49..3a3fd154a17 100644 --- a/src/osd/scrubber/pg_scrubber.h +++ b/src/osd/scrubber/pg_scrubber.h @@ -669,7 +669,7 @@ class PgScrubber : public ScrubPgIF, * the current scrubbing operation is done. We should mark that fact, so that * all events related to the previous operation can be discarded. */ - void advance_token(); + void reset_replica_state(); bool is_token_current(Scrub::act_token_t received_token);