]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scrub: fix 'schedule-deepscrub' test asok command 60661/head
authorRonen Friedman <rfriedma@redhat.com>
Wed, 6 Nov 2024 14:43:57 +0000 (08:43 -0600)
committerRonen Friedman <rfriedma@redhat.com>
Thu, 7 Nov 2024 13:34:16 +0000 (07:34 -0600)
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 <rfriedma@redhat.com>
src/osd/scrubber/pg_scrubber.cc

index c37f31d28dc9d99f6750500a3f603149a4ddbf29..bdea0765279106a5128505dc3bf278f202f52947 100644 (file)
@@ -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);
   }