From: David Zafman Date: Tue, 18 Jun 2019 05:03:38 +0000 (-0700) Subject: osd: Handle osd_max_scrub > 1 by not getting stuck on first ScrubJob X-Git-Tag: v15.1.0~2302^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d938b28565c801b1a6de8e8ce585f2389595311b;p=ceph.git osd: Handle osd_max_scrub > 1 by not getting stuck on first ScrubJob Signed-off-by: David Zafman --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 08772d3f51c..2f07918418b 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -7140,6 +7140,18 @@ void OSD::sched_scrub() PGRef pg = _lookup_lock_pg(scrub.pgid); if (!pg) continue; + // This has already started, so go on to the next scrub job + if (pg->scrubber.active) { + pg->unlock(); + dout(30) << __func__ << ": already in progress pgid " << scrub.pgid << dendl; + continue; + } + // If it is reserving, let it resolve before going to the next scrub job + if (pg->scrubber.reserved) { + pg->unlock(); + dout(30) << __func__ << ": reserve in progress pgid " << scrub.pgid << dendl; + break; + } dout(10) << "sched_scrub scrubbing " << scrub.pgid << " at " << scrub.sched_time << (pg->get_must_scrub() ? ", explicitly requested" : (load_is_low ? ", load_is_low" : " deadline < now")) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index ce0524fb8b5..92504127ded 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1326,7 +1326,8 @@ void PG::requeue_map_waiters() bool PG::sched_scrub() { ceph_assert(is_locked()); - if (!(is_primary() && is_active() && is_clean() && !is_scrubbing())) { + ceph_assert(!is_scrubbing()); + if (!(is_primary() && is_active() && is_clean())) { return false; }