From 9cccb68f5b92b0955d19e694bf89bb1cb6dd1c9d Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Sat, 4 Oct 2025 11:58:40 -0500 Subject: [PATCH] osd/scrub: scanning the rollbacks not mandating a reschedule The scrubber calls PG::_scan_rollback_obs() to clean up obsolete rollback objects. This function may queue a transaction to delete such objects. The commit modifies the scrubber, so that no rescheduling of the scrub is mandated if no transaction was queued. Fixes: https://tracker.ceph.com/issues/73773 Signed-off-by: Ronen Friedman --- src/osd/PG.cc | 4 +++- src/osd/PG.h | 10 +++++++++- src/osd/scrubber/pg_scrubber.cc | 8 ++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index fe1c51e7595b1..0c0e95c559723 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1743,7 +1743,7 @@ void PG::unreserve_recovery_space() { local_num_bytes.store(0); } -void PG::_scan_rollback_obs(const vector &rollback_obs) +bool PG::_scan_rollback_obs(const vector &rollback_obs) { ObjectStore::Transaction t; eversion_t trimmed_to = recovery_state.get_last_rollback_info_trimmed_to_applied(); @@ -1764,7 +1764,9 @@ void PG::_scan_rollback_obs(const vector &rollback_obs) derr << __func__ << ": queueing trans to clean up obsolete rollback objs" << dendl; osd->store->queue_transaction(ch, std::move(t), NULL); + return true; // a transaction was queued } + return false; } diff --git a/src/osd/PG.h b/src/osd/PG.h index faacab7925009..43795697fd169 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1228,7 +1228,15 @@ protected: [[nodiscard]] bool ops_blocked_by_scrub() const; [[nodiscard]] Scrub::scrub_prio_t is_scrub_blocking_ops() const; - void _scan_rollback_obs(const std::vector &rollback_obs); + + /** + * Scan the given list of rollback objects for obsolete entries. + * If found - the obsolete entries are removed. + * + * @return 'true' if a transaction was issued. + */ + bool _scan_rollback_obs(const std::vector &rollback_obs); + /** * returns true if [begin, end) is good to scrub at this time * a false return value obliges the implementer to requeue scrub when the diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index 243d18c171252..1d6b8898c92b5 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -1381,9 +1381,13 @@ int PgScrubber::build_scrub_map_chunk(ScrubMap& map, if (pos.ls.empty()) { break; } - m_pg->_scan_rollback_obs(rollback_obs); pos.pos = 0; - return -EINPROGRESS; + if (m_pg->_scan_rollback_obs(rollback_obs)) { + // we had to perform some real work (queue a transaction + // to discard obsolete rollback versions of objects in the + // selected range). Let's reschedule the scrub. + return -EINPROGRESS; + } } // scan objects -- 2.39.5