Skip to content

Commit 12c88f8

Browse files
committed
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 <[email protected]> (cherry picked from commit 0d1ba9d)
1 parent 27f2db0 commit 12c88f8

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

src/osd/scrubber/pg_scrubber.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,9 @@ void PgScrubber::set_op_parameters(ScrubPGPreconds pg_cond)
16061606
state_set(PG_STATE_DEEP_SCRUB);
16071607
}
16081608

1609-
m_flags.auto_repair = m_is_deep && pg_cond.can_autorepair;
1609+
m_flags.auto_repair =
1610+
m_is_deep && pg_cond.can_autorepair &&
1611+
ScrubJob::is_autorepair_allowed(m_active_target->urgency());
16101612

16111613
// m_is_repair is set for all repair cases - for operator-requested
16121614
// repairs, for deep-scrubs initiated automatically after a shallow scrub
@@ -1845,7 +1847,10 @@ void PgScrubber::scrub_finish()
18451847
static_cast<int>(m_pg->cct->_conf->osd_scrub_auto_repair_num_errors)) {
18461848
ceph_assert(!m_is_deep);
18471849
do_auto_scrub = true;
1848-
dout(15) << __func__ << " Try to auto repair after scrub errors" << dendl;
1850+
dout(10) << fmt::format("{}: will initiate a deep scrub to fix {} errors",
1851+
__func__,
1852+
m_be->authoritative_peers_count())
1853+
<< dendl;
18491854
}
18501855

18511856
m_flags.deep_scrub_on_error = false;

src/osd/scrubber/scrub_job.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,12 @@ bool ScrubJob::has_high_queue_priority(urgency_t urgency)
411411

412412
bool ScrubJob::is_repair_implied(urgency_t urgency)
413413
{
414-
return urgency == urgency_t::after_repair ||
414+
return urgency == urgency_t::repairing || urgency == urgency_t::must_repair;
415+
}
416+
417+
bool ScrubJob::is_autorepair_allowed(urgency_t urgency)
418+
{
419+
// note: 'after-repair' scrubs are not allowed to auto-repair
420+
return urgency == urgency_t::periodic_regular ||
415421
urgency == urgency_t::repairing || urgency == urgency_t::must_repair;
416422
}

src/osd/scrubber/scrub_job.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ class ScrubJob {
371371
static bool has_high_queue_priority(urgency_t urgency);
372372

373373
static bool is_repair_implied(urgency_t urgency);
374+
375+
static bool is_autorepair_allowed(urgency_t urgency);
374376
};
375377
} // namespace Scrub
376378

src/osd/scrubber/scrub_queue_entry.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ namespace Scrub {
3434
*
3535
* 'after_repair' - triggered immediately after a recovery process
3636
* ('m_after_repair_scrub_required' was set).
37-
* This type of scrub is always deep.
38-
* (note: this urgency level is not implemented in this commit)
37+
* This type of scrub is always deep, and never auto-repairs.
3938
*
4039
* 'repairing' - the target is currently being deep-scrubbed with the repair
4140
* flag set. Triggered by a previous shallow scrub that ended with errors.

0 commit comments

Comments
 (0)