]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: return fast if PG::deleting is true in snap_trimmer and PG::scrub 4136/head
authorXinze Chi <xmdxcxz@gmail.com>
Sun, 22 Mar 2015 17:55:08 +0000 (17:55 +0000)
committerXinze Chi <xmdxcxz@gmail.com>
Sun, 22 Mar 2015 17:55:08 +0000 (17:55 +0000)
Signed-off-by: Xinze Chi <xmdxcxz@gmail.com>
src/osd/PG.cc
src/osd/ReplicatedPG.cc

index e09ea8ea54fa3a20e7674c26e8698d2ec216e231..d5904ae9cd1c9baa9de3a710d7e36b26860d8371 100644 (file)
@@ -3777,6 +3777,10 @@ void PG::replica_scrub(
 void PG::scrub(ThreadPool::TPHandle &handle)
 {
   lock();
+  if (deleting) {
+    unlock();
+    return;
+  }
   if (g_conf->osd_scrub_sleep > 0 &&
       (scrubber.state == PG::Scrubber::NEW_CHUNK ||
        scrubber.state == PG::Scrubber::INACTIVE)) {
@@ -3788,10 +3792,6 @@ void PG::scrub(ThreadPool::TPHandle &handle)
     lock();
     dout(20) << __func__ << " slept for " << t << dendl;
   }
-  if (deleting) {
-    unlock();
-    return;
-  }
 
   if (!is_primary() || !is_active() || !is_clean() || !is_scrubbing()) {
     dout(10) << "scrub -- not primary or active or not clean" << dendl;
index a01c57c6b8959f06e7ced78bec2ea583c7c089eb..009f003234bc88683f6b3b709f457e9de100536f 100644 (file)
@@ -3087,18 +3087,18 @@ ReplicatedPG::RepGather *ReplicatedPG::trim_object(const hobject_t &coid)
 
 void ReplicatedPG::snap_trimmer()
 {
+  lock();
+  if (deleting) {
+    unlock();
+    return;
+  }
   if (g_conf->osd_snap_trim_sleep > 0) {
+    unlock();
     utime_t t;
     t.set_from_double(g_conf->osd_snap_trim_sleep);
     t.sleep();
     lock();
     dout(20) << __func__ << " slept for " << t << dendl;
-  } else {
-    lock();
-  }
-  if (deleting) {
-    unlock();
-    return;
   }
   dout(10) << "snap_trimmer entry" << dendl;
   if (is_primary()) {