From: Ronen Friedman Date: Sun, 28 Jul 2024 10:52:38 +0000 (-0500) Subject: osd/scrub: fix ReplicaReservations ctor to use correct query X-Git-Tag: v20.0.0~1219^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=90176a2ec8b3a3d2e929c66c7367ed5fc273d551;p=ceph.git osd/scrub: fix ReplicaReservations ctor to use correct query when determining whether replica reservations are required. Signed-off-by: Ronen Friedman --- diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index 37b461cf3bbf..4b439bf8ec5c 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -946,9 +946,10 @@ int PgScrubber::get_whoami() const return m_osds->whoami; } -[[nodiscard]] bool PgScrubber::is_high_priority() const +[[nodiscard]] bool PgScrubber::is_reservation_required() const { - return m_flags.required; + ceph_assert(m_active_target); + return ScrubJob::requires_reservation(m_active_target->urgency()); } /* diff --git a/src/osd/scrubber/pg_scrubber.h b/src/osd/scrubber/pg_scrubber.h index a2f607a8401b..0b114e545884 100644 --- a/src/osd/scrubber/pg_scrubber.h +++ b/src/osd/scrubber/pg_scrubber.h @@ -398,8 +398,8 @@ class PgScrubber : public ScrubPgIF, return m_pg->recovery_state.is_primary(); } - /// is this scrub more than just regular periodic scrub? - [[nodiscard]] bool is_high_priority() const final; + /// is this scrub's urgency high enough, or must it reserve its replicas? + [[nodiscard]] bool is_reservation_required() const final; void set_state_name(const char* name) final { diff --git a/src/osd/scrubber/scrub_machine_lstnr.h b/src/osd/scrubber/scrub_machine_lstnr.h index 39b853bb6f97..050e29cb8e2c 100644 --- a/src/osd/scrubber/scrub_machine_lstnr.h +++ b/src/osd/scrubber/scrub_machine_lstnr.h @@ -250,6 +250,6 @@ struct ScrubMachineListener { /// delay next retry of this PG after a replica reservation failure virtual void flag_reservations_failure() = 0; - /// is this scrub more than just regular periodic scrub? - [[nodiscard]] virtual bool is_high_priority() const = 0; + /// is this scrub's urgency high enough, or must it reserve its replicas? + [[nodiscard]] virtual bool is_reservation_required() const = 0; }; diff --git a/src/osd/scrubber/scrub_reservations.cc b/src/osd/scrubber/scrub_reservations.cc index ec9ac598ea51..fb9593597e97 100644 --- a/src/osd/scrubber/scrub_reservations.cc +++ b/src/osd/scrubber/scrub_reservations.cc @@ -54,15 +54,15 @@ ReplicaReservations::ReplicaReservations( m_perf_set.set(scrbcnt_resrv_replicas_num, m_sorted_secondaries.size()); m_next_to_request = m_sorted_secondaries.cbegin(); - if (m_scrubber.is_high_priority()) { + if (m_scrubber.is_reservation_required()) { + // send out the 1'st request (unless we have no replicas) + m_process_started_at = ScrubClock::now(); + send_next_reservation_or_complete(); + } else { // for high-priority scrubs (i.e. - user-initiated), no reservations are // needed. Note: not perf-counted as either success or failure. dout(10) << "high-priority scrub - no reservations needed" << dendl; m_perf_set.inc(scrbcnt_resrv_skipped); - } else { - // send out the 1'st request (unless we have no replicas) - m_process_started_at = ScrubClock::now(); - send_next_reservation_or_complete(); } }