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
static_cast<int>(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;
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;
}
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
*
* '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.