From d938b28565c801b1a6de8e8ce585f2389595311b Mon Sep 17 00:00:00 2001 From: David Zafman Date: Mon, 17 Jun 2019 22:03:38 -0700 Subject: [PATCH] osd: Handle osd_max_scrub > 1 by not getting stuck on first ScrubJob Signed-off-by: David Zafman --- src/osd/OSD.cc | 12 ++++++++++++ src/osd/PG.cc | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) 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; } -- 2.39.5