From 50fbfeffbe76ad683df2dd97e4f65ca6d980e91d Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Wed, 23 Jun 2021 20:02:28 +0300 Subject: [PATCH] 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 --- src/osd/PG.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 4fa4e634d23d2..dcc4f8204b864 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1330,8 +1330,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; } -- 2.39.5