Skip to content

Commit ca6b06c

Browse files
authored
Merge pull request ceph#64849 from ronen-fr/wip-rf-72420repair
osd/scrub: do not limit operator-initiated repairs Reviewed-by: Alex Ainscow <[email protected]> Reviewed-by: Radoslaw Zarzynski <[email protected]>
2 parents f153bb2 + 5afc446 commit ca6b06c

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

src/osd/scrubber/pg_scrubber.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,10 +1828,17 @@ void PgScrubber::scrub_finish()
18281828
// if the repair request comes from auto-repair and there is a large
18291829
// number of objects known to be damaged, we cancel the auto-repair
18301830
if (m_is_repair && m_flags.auto_repair &&
1831+
ScrubJob::is_repairs_count_limited(m_active_target->urgency()) &&
18311832
m_be->authoritative_peers_count() >
1832-
static_cast<int>(m_pg->cct->_conf->osd_scrub_auto_repair_num_errors)) {
1833+
static_cast<int>(
1834+
m_pg->cct->_conf->osd_scrub_auto_repair_num_errors)) {
18331835

1834-
dout(10) << __func__ << " undoing the repair" << dendl;
1836+
dout(5) << fmt::format(
1837+
"{}: undoing the repair. Damaged objects count ({}) is "
1838+
"above configured limit ({})",
1839+
__func__, m_be->authoritative_peers_count(),
1840+
m_pg->cct->_conf->osd_scrub_auto_repair_num_errors)
1841+
<< dendl;
18351842
state_clear(PG_STATE_REPAIR); // not expected to be set, anyway
18361843
m_is_repair = false;
18371844
update_op_mode_text();

src/osd/scrubber/scrub_job.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,3 +426,8 @@ bool ScrubJob::is_autorepair_allowed(urgency_t urgency)
426426
urgency == urgency_t::operator_requested ||
427427
urgency == urgency_t::repairing || urgency == urgency_t::must_repair;
428428
}
429+
430+
bool ScrubJob::is_repairs_count_limited(urgency_t urgency)
431+
{
432+
return urgency < urgency_t::operator_requested;
433+
}

src/osd/scrubber/scrub_job.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,13 @@ class ScrubJob {
375375
static bool is_repair_implied(urgency_t urgency);
376376

377377
static bool is_autorepair_allowed(urgency_t urgency);
378+
379+
/**
380+
* should we cancel the repair if the number of damaged objects
381+
* exceeds the configured limit ('osd_scrub_auto_repair_num_errors')?
382+
* This does not apply to any repair that was operator-initiated.
383+
*/
384+
static bool is_repairs_count_limited(urgency_t urgency);
378385
};
379386
} // namespace Scrub
380387

0 commit comments

Comments
 (0)