From 0d1ba9de151c4a6dc2b2a8568fb9932d7b6ea49a Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Tue, 27 May 2025 10:13:09 -0500 Subject: [PATCH] osd/scrub: no auto-repair in 'after_repair' type of scrubs The deep scrubs that are initiated after a full "peering" repair, are not supposed to auto-repair any errors - just report them. This behavior detail was inadvertently changed recently, and is fixed here. Fixes: https://tracker.ceph.com/issues/71463 Signed-off-by: Ronen Friedman --- src/osd/scrubber/pg_scrubber.cc | 9 +++++++-- src/osd/scrubber/scrub_job.cc | 8 +++++++- src/osd/scrubber/scrub_job.h | 2 ++ src/osd/scrubber/scrub_queue_entry.h | 3 +-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index e314a2238cf..9dfc429070b 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -1606,7 +1606,9 @@ void PgScrubber::set_op_parameters(ScrubPGPreconds pg_cond) state_set(PG_STATE_DEEP_SCRUB); } - m_flags.auto_repair = m_is_deep && pg_cond.can_autorepair; + m_flags.auto_repair = + m_is_deep && pg_cond.can_autorepair && + ScrubJob::is_autorepair_allowed(m_active_target->urgency()); // m_is_repair is set for all repair cases - for operator-requested // repairs, for deep-scrubs initiated automatically after a shallow scrub @@ -1845,7 +1847,10 @@ void PgScrubber::scrub_finish() static_cast(m_pg->cct->_conf->osd_scrub_auto_repair_num_errors)) { ceph_assert(!m_is_deep); do_auto_scrub = true; - dout(15) << __func__ << " Try to auto repair after scrub errors" << dendl; + dout(10) << fmt::format("{}: will initiate a deep scrub to fix {} errors", + __func__, + m_be->authoritative_peers_count()) + << dendl; } m_flags.deep_scrub_on_error = false; diff --git a/src/osd/scrubber/scrub_job.cc b/src/osd/scrubber/scrub_job.cc index a5e870e3853..7de1ade57e6 100644 --- a/src/osd/scrubber/scrub_job.cc +++ b/src/osd/scrubber/scrub_job.cc @@ -411,6 +411,12 @@ bool ScrubJob::has_high_queue_priority(urgency_t urgency) bool ScrubJob::is_repair_implied(urgency_t urgency) { - return urgency == urgency_t::after_repair || + return urgency == urgency_t::repairing || urgency == urgency_t::must_repair; +} + +bool ScrubJob::is_autorepair_allowed(urgency_t urgency) +{ + // note: 'after-repair' scrubs are not allowed to auto-repair + return urgency == urgency_t::periodic_regular || urgency == urgency_t::repairing || urgency == urgency_t::must_repair; } diff --git a/src/osd/scrubber/scrub_job.h b/src/osd/scrubber/scrub_job.h index 062f747605c..c170c3eb881 100644 --- a/src/osd/scrubber/scrub_job.h +++ b/src/osd/scrubber/scrub_job.h @@ -371,6 +371,8 @@ class ScrubJob { static bool has_high_queue_priority(urgency_t urgency); static bool is_repair_implied(urgency_t urgency); + + static bool is_autorepair_allowed(urgency_t urgency); }; } // namespace Scrub diff --git a/src/osd/scrubber/scrub_queue_entry.h b/src/osd/scrubber/scrub_queue_entry.h index 88af31a0ad1..edaff94524a 100644 --- a/src/osd/scrubber/scrub_queue_entry.h +++ b/src/osd/scrubber/scrub_queue_entry.h @@ -34,8 +34,7 @@ namespace Scrub { * * 'after_repair' - triggered immediately after a recovery process * ('m_after_repair_scrub_required' was set). - * This type of scrub is always deep. - * (note: this urgency level is not implemented in this commit) + * This type of scrub is always deep, and never auto-repairs. * * 'repairing' - the target is currently being deep-scrubbed with the repair * flag set. Triggered by a previous shallow scrub that ended with errors. -- 2.39.5