]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PG::sched_scrub: return true if scrub newly kicked off
authorSamuel Just <sam.just@inktank.com>
Fri, 21 Dec 2012 19:33:45 +0000 (11:33 -0800)
committerSamuel Just <sam.just@inktank.com>
Fri, 21 Dec 2012 19:36:54 +0000 (11:36 -0800)
The previous return value wasn't really what OSD::sched_scrub
wanted to know.

Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/OSD.cc
src/osd/PG.cc

index 1a400c506e1a587c04d5edb0766c0cfee935bd00..ff9992a1c32a1114c5de7cb909d45cb782d4580c 100644 (file)
@@ -3589,7 +3589,7 @@ void OSD::sched_scrub()
     dout(10) << " on " << t << " " << pgid << dendl;
     PG *pg = _lookup_lock_pg(pgid);
     if (pg) {
-      if (pg->is_active() && !pg->sched_scrub()) {
+      if (pg->is_active() && pg->sched_scrub()) {
        pg->unlock();
        break;
       }
index 54a75be5e6ae5a8f9b585b6cb6aa7fb4173f3713..04beea73b16778f23c2a675fdd096700218698b3 100644 (file)
@@ -2997,18 +2997,18 @@ void PG::requeue_ops(list<OpRequestRef> &ls)
  *     osd->scrubber.active++
  */
 
-// returns false if waiting for a reply
+// returns true if a scrub has been newly kicked off
 bool PG::sched_scrub()
 {
   assert(_lock.is_locked());
   if (!(is_primary() && is_active() && is_clean() && !is_scrubbing())) {
-    return true;
+    return false;
   }
 
   // just scrubbed?
   if (info.history.last_scrub_stamp + g_conf->osd_scrub_min_interval > ceph_clock_now(g_ceph_context)) {
     dout(20) << "sched_scrub: just scrubbed, skipping" << dendl;
-    return true;
+    return false;
   }
 
   if (ceph_clock_now(g_ceph_context) > info.history.last_deep_scrub_stamp + g_conf->osd_deep_scrub_interval) {
@@ -3016,7 +3016,7 @@ bool PG::sched_scrub()
     state_set(PG_STATE_DEEP_SCRUB);
   }
 
-  bool ret = false;
+  bool ret = true;
   if (!scrubber.reserved) {
     assert(scrubber.reserved_peers.empty());
     if (osd->inc_scrubs_pending()) {
@@ -3026,6 +3026,7 @@ bool PG::sched_scrub()
       scrub_reserve_replicas();
     } else {
       dout(20) << "sched_scrub: failed to reserve locally" << dendl;
+      ret = false;
     }
   }
   if (scrubber.reserved) {
@@ -3033,11 +3034,10 @@ bool PG::sched_scrub()
       dout(20) << "sched_scrub: failed, a peer declined" << dendl;
       clear_scrub_reserved();
       scrub_unreserve_replicas();
-      ret = true;
+      ret = false;
     } else if (scrubber.reserved_peers.size() == acting.size()) {
       dout(20) << "sched_scrub: success, reserved self and replicas" << dendl;
       queue_scrub();
-      ret = true;
     } else {
       // none declined, since scrubber.reserved is set
       dout(20) << "sched_scrub: reserved " << scrubber.reserved_peers << ", waiting for replicas" << dendl;