]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scrub: only periodic_regular scrubs should extended-sleep 63597/head
authorRonen Friedman <rfriedma@redhat.com>
Wed, 28 May 2025 14:26:29 +0000 (09:26 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Sat, 31 May 2025 07:34:28 +0000 (02:34 -0500)
Fix get_scrub_sleep_time() call parameters, to use the correct
logic (observes_extended_sleep()) for sleep time calculations.

Fixes: https://tracker.ceph.com/issues/70923
Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
(cherry picked from commit 705857f67fd86ec406ac0d444e449e63dfe55340)

src/osd/scrubber/osd_scrub.cc
src/osd/scrubber/osd_scrub.h
src/osd/scrubber/pg_scrubber.cc
src/osd/scrubber/scrub_job.cc
src/osd/scrubber/scrub_job.h

index 512071859497e765dca905a210cb8962ac3dd420..a224697be6a866fde021a25ee713711fea113cef 100644 (file)
@@ -348,13 +348,13 @@ bool OsdScrub::scrub_time_permit(utime_t now) const
 
 
 std::chrono::milliseconds OsdScrub::scrub_sleep_time(
-    utime_t t,
-    bool high_priority_scrub) const
+    utime_t t_now,
+    bool scrub_respects_ext_sleep) const
 {
   const milliseconds regular_sleep_period =
       milliseconds{int64_t(std::max(0.0, 1'000 * conf->osd_scrub_sleep))};
 
-  if (high_priority_scrub || scrub_time_permit(t)) {
+  if (!scrub_respects_ext_sleep || scrub_time_permit(t_now)) {
     return regular_sleep_period;
   }
 
index 4e510c91182d3ec1b6687053c1e72bcf9881aa5c..b464fa9ce013503855b6fce4bcc9ad79c18314b5 100644 (file)
@@ -104,12 +104,16 @@ class OsdScrub {
    * chunks.
    *
    * Implementation Note: Returned value is either osd_scrub_sleep or
-   * osd_scrub_extended_sleep, depending on must_scrub_param and time
-   * of day (see configs osd_scrub_begin*)
+   * osd_scrub_extended_sleep:
+   * - if scrubs are allowed at this point in time - osd_scrub_sleep; otherwise
+   *   (i.e. - the current time is outside of the allowed scrubbing hours/days,
+   *   but the scrub started earlier):
+   * - if the scrub observes "extended sleep" (i.e. - it's a low urgency
+   *   scrub) - osd_scrub_extended_sleep.
    */
   std::chrono::milliseconds scrub_sleep_time(
-      utime_t t,
-      bool high_priority_scrub) const;
+      utime_t t_now,
+      bool scrub_respects_ext_sleep) const;
 
 
   /**
index e314a2238cfb1a4c44ebdf9f48d758c57c2a7348..bdb36753fdfc1cd437fd37a061e386ac26160dc9 100644 (file)
@@ -2565,7 +2565,7 @@ std::chrono::milliseconds PgScrubber::get_scrub_sleep_time() const
 {
   return m_osds->get_scrub_services().scrub_sleep_time(
       ceph_clock_now(),
-      !ScrubJob::observes_allowed_hours(m_active_target->urgency()));
+      ScrubJob::observes_extended_sleep(m_active_target->urgency()));
 }
 
 void PgScrubber::queue_for_scrub_resched(Scrub::scrub_prio_t prio)
index a5e870e3853f217a23ba0d7176824cba3b720fb9..1e08d94068135ca4f373277ba3890d51d315eb70 100644 (file)
@@ -374,6 +374,11 @@ bool ScrubJob::observes_allowed_hours(urgency_t urgency)
   return urgency < urgency_t::operator_requested;
 }
 
+bool ScrubJob::observes_extended_sleep(urgency_t urgency)
+{
+  return urgency == urgency_t::periodic_regular;
+}
+
 bool ScrubJob::observes_load_limit(urgency_t urgency)
 {
   return urgency < urgency_t::after_repair;
index 062f747605c936cbd4c90b8d759bb1359b55eb42..c838703919ddc45cac64d01fe53aae4213e23ae8 100644 (file)
@@ -336,14 +336,14 @@ class ScrubJob {
  *  | limitation |  must-  | after-repair |repairing| operator | must-repair |
  *  |            |  scrub  |(aft recovery)|(errors) | request  |             |
  *  +------------+---------+--------------+---------+----------+-------------+
- *  | reservation|    yes! |      no      |    no?  +     no   |      no     |
- *  | dow/time   |    yes  |     yes      |    no   +     no   |      no     |
- *  | ext-sleep  |    no   |      no      |    no   +     no   |      no     |
- *  | load       |    yes  |      no      |    no   +     no   |      no     |
- *  | noscrub    |    yes  |      no?     |    Yes  +     no   |      no     |
- *  | max-scrubs |    yes  |      yes     |    Yes  +     no   |      no     |
- *  | backoff    |    yes  |      no      |    no   +     no   |      no     |
- *  | recovery   |    yes  |      yes     |    Yes  +     no   |      no     |
+ *  | reservation|    yes! |      no      |    no?  |     no   |      no     |
+ *  | dow/time   |    yes  |     yes      |    no   |     no   |      no     |
+ *  | ext-sleep  |    no   |      no      |    no   |     no   |      no     |
+ *  | load       |    yes  |      no      |    no   |     no   |      no     |
+ *  | noscrub    |    yes  |      no      |    Yes  |     no   |      no     |
+ *  | max-scrubs |    yes  |      yes     |    Yes  |     no   |      no     |
+ *  | backoff    |    yes  |      no      |    no   |     no   |      no     |
+ *  | recovery   |    yes  |      yes     |    Yes  |     no   |      no     |
  *  +------------+---------+--------------+---------+----------+-------------+
  */
 
@@ -354,6 +354,8 @@ class ScrubJob {
 
   static bool observes_allowed_hours(urgency_t urgency);
 
+  static bool observes_extended_sleep(urgency_t urgency);
+
   static bool observes_load_limit(urgency_t urgency);
 
   static bool requires_reservation(urgency_t urgency);