From: Ronen Friedman Date: Wed, 23 Jun 2021 17:02:28 +0000 (+0300) Subject: osd/scrub: replace a ceph_assert() with a test X-Git-Tag: v16.2.5~24^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c12d951d6d8d58e5bb84f11d4db55b8b1ae3df85;p=ceph.git osd/scrub: replace a ceph_assert() with a test We are using two distinct conditions to decide whether a candidate PG is already being scrubbed. The OSD checks pgs_scrub_active(), while the PG asserts on the value of PG_STATE_FLAG. There is a time window when PG_STATE_FLAG is set but is_scrub_active() wasn't yet set. is_reserving() covers most of that period, but the ceph_assert is just before the is_reserving check. fixes: https://tracker.ceph.com/issues/50346 Signed-off-by: Ronen Friedman (cherry picked from commit 50fbfeffbe76ad683df2dd97e4f65ca6d980e91d) --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 7de0d5573c6..2a582f3b527 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1336,8 +1336,11 @@ bool PG::sched_scrub() << (is_active() ? ") " : ") ") << (is_clean() ? " " : " ") << dendl; ceph_assert(ceph_mutex_is_locked(_lock)); - ceph_assert(!is_scrubbing()); + if (m_scrubber && m_scrubber->is_scrub_active()) { + return false; + } + if (!is_primary() || !is_active() || !is_clean()) { return false; }