From ab49ca023a2e9052c709e05ec65022572b8a499f Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Wed, 6 Nov 2024 08:43:57 -0600 Subject: [PATCH] osd/scrub: fix 'schedule-deepscrub' test asok command The existing implementation of the 'schedule-deepscrub' Asok command uses the set_last_deep_scrub_stamp() method to "fake" the last-deep-scrub stamp. Unfortunately, this method also updates the last-scrub stamp (as required for non-test usage). Commit 9f3e18b fixed the comparator used when sorting the scrub targets. An unintended side effect is that following 'schedule-deepscrub' - the shallow target is the one to be scrubbed next, instead of the deep target. Signed-off-by: Ronen Friedman --- src/osd/scrubber/pg_scrubber.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index c37f31d28dc9d..bdea076527910 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -766,8 +766,13 @@ void PgScrubber::on_operator_periodic_cmd( asok_response_section(f, true, scrub_level, stamp); if (scrub_level == scrub_level_t::deep) { + const auto saved_shallow_stamp = m_pg->info.history.last_scrub_stamp; // this call sets both stamps m_pg->set_last_deep_scrub_stamp(stamp); + // restore the shallow stamp, as otherwise it will be scheduled before + // the deep, failing whatever test code called us (this is a test-only + // interface). + m_pg->set_last_scrub_stamp(saved_shallow_stamp); } else { m_pg->set_last_scrub_stamp(stamp); } -- 2.39.5