From 79b19a6ca5f691a63b684320179290fc6e53bb4f Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Wed, 6 Apr 2016 10:42:20 +0800 Subject: [PATCH] osd: cancel scrub if noscrub is set for pool or all The sched_scrub() method can be called by various code path, such as OSD::tick() or triggered by a scrub_reserve_reply message. The sched_scrub() will check whether or not the noscrub is globally set or set for a specified pool before really starting to schedule a scrub job. However, if we set noscrub flag for a specified pool, there are other pools for which scrub are still legal and thus shall be granted. The problem here is that we may stopping a pg's scrub in an intermidate stage due to setting of the corresponding pool's noscrub flag whithout releasing the reservation. Which as a result shall prevent other pgs of a different pool from going scrubbing because we have already hit the reservation limit. Signed-off-by: xie xingguo --- src/osd/PG.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 09b9ef132ccc..1464a7d7590f 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -3357,8 +3357,16 @@ bool PG::sched_scrub() //NOSCRUB so skip regular scrubs if ((osd->osd->get_osdmap()->test_flag(CEPH_OSDMAP_NOSCRUB) || - pool.info.has_flag(pg_pool_t::FLAG_NOSCRUB)) && !time_for_deep) + pool.info.has_flag(pg_pool_t::FLAG_NOSCRUB)) && !time_for_deep) { + if (scrubber.reserved) { + // cancel scrub if it is still in scheduling, + // so pgs from other pools where scrub are still legal + // have a chance to go ahead with scrubbing. + clear_scrub_reserved(); + scrub_unreserve_replicas(); + } return false; + } } if (cct->_conf->osd_scrub_auto_repair -- 2.47.3