From: Xinze Chi Date: Sun, 22 Mar 2015 17:55:08 +0000 (+0000) Subject: osd: return fast if PG::deleting is true in snap_trimmer and PG::scrub X-Git-Tag: v9.0.1~159^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3cffbbef05c088bc367a890e6c9bcee9f32af0dd;p=ceph.git osd: return fast if PG::deleting is true in snap_trimmer and PG::scrub Signed-off-by: Xinze Chi --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index e09ea8ea54fa..d5904ae9cd1c 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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; diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index a01c57c6b895..009f003234bc 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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()) {