]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: Handle osd_max_scrub > 1 by not getting stuck on first ScrubJob
authorDavid Zafman <dzafman@redhat.com>
Tue, 18 Jun 2019 05:03:38 +0000 (22:03 -0700)
committerDavid Zafman <dzafman@redhat.com>
Thu, 27 Jun 2019 21:20:54 +0000 (14:20 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/osd/OSD.cc
src/osd/PG.cc

index 08772d3f51cdae0a271be17a631e750154bc62b8..2f07918418bc0afc33d59cb11580036e6413dd8f 100644 (file)
@@ -7140,6 +7140,18 @@ void OSD::sched_scrub()
       PGRef pg = _lookup_lock_pg(scrub.pgid);
       if (!pg)
        continue;
+      // This has already started, so go on to the next scrub job
+      if (pg->scrubber.active) {
+       pg->unlock();
+       dout(30) << __func__ << ": already in progress pgid " << scrub.pgid << dendl;
+       continue;
+      }
+      // If it is reserving, let it resolve before going to the next scrub job
+      if (pg->scrubber.reserved) {
+       pg->unlock();
+       dout(30) << __func__ << ": reserve in progress pgid " << scrub.pgid << dendl;
+       break;
+      }
       dout(10) << "sched_scrub scrubbing " << scrub.pgid << " at " << scrub.sched_time
               << (pg->get_must_scrub() ? ", explicitly requested" :
                   (load_is_low ? ", load_is_low" : " deadline < now"))
index ce0524fb8b540cf5b50e010260481115c440d46e..92504127ded015f3c17cc3eb2f96e43f43ebd16e 100644 (file)
@@ -1326,7 +1326,8 @@ void PG::requeue_map_waiters()
 bool PG::sched_scrub()
 {
   ceph_assert(is_locked());
-  if (!(is_primary() && is_active() && is_clean() && !is_scrubbing())) {
+  ceph_assert(!is_scrubbing());
+  if (!(is_primary() && is_active() && is_clean())) {
     return false;
   }