]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSD.cc: lock the pg only when all conditional checks are passed when 14968/head
authorJin Cai <caijin.caij@alibaba-inc.com>
Fri, 5 May 2017 08:29:25 +0000 (16:29 +0800)
committerJin Cai <caijin.caij@alibaba-inc.com>
Fri, 5 May 2017 09:53:22 +0000 (17:53 +0800)
scheduling a  scrub

Signed-off-by: Jin Cai <caijin.caij@alibaba-inc.com>
src/osd/OSD.cc

index b196f1fba9e0c6d7a5eadc49c6d9c79069111e2d..95645e805798b2c14288b91f2154a956a54d53cd 100644 (file)
@@ -6833,11 +6833,16 @@ void OSD::sched_scrub()
         break;
       }
 
+      if ((scrub.deadline >= now) && !(time_permit && load_is_low)) {
+        dout(10) << __func__ << " not scheduling scrub for " << scrub.pgid << " due to "
+                 << (!time_permit ? "time not permit" : "high load") << dendl;
+        continue;
+      }
+
       PG *pg = _lookup_lock_pg(scrub.pgid);
       if (!pg)
        continue;
-      if (pg->get_pgbackend()->scrub_supported() && pg->is_active() &&
-         (scrub.deadline < now || (time_permit && load_is_low))) {
+      if (pg->get_pgbackend()->scrub_supported() && pg->is_active()) {
        dout(10) << "sched_scrub scrubbing " << scrub.pgid << " at " << scrub.sched_time
                 << (pg->scrubber.must_scrub ? ", explicitly requested" :
                     (load_is_low ? ", load_is_low" : " deadline < now"))