From: Ronen Friedman Date: Fri, 25 Mar 2022 10:45:47 +0000 (+0000) Subject: pacific: osd/scrub: restart snap trimming only after scrubbing is done X-Git-Tag: v16.2.8~29^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b010892d30750e48810a64a87cb9ef542006d293;p=ceph.git pacific: osd/scrub: restart snap trimming only after scrubbing is done Snap trimming that was postponed as the target PG was scrubbing must be restarted at scrub completion. PR #38111 moved trimming restart to just before the scrub fully terminated. The current PR fixes that. Trimming is also restarted in those cases where scrub was queued but aborted immediately. Fixes: https://tracker.ceph.com/issues/52026 Signed-off-by: Ronen Friedman (cherry picked from commit 948d3266c67bf896d1c20472977b849178d233d3) Conflicts: src/osd/pg_scrubber.cc Conflict resolved by removing a clear_queued_or_active() call that was dragged in. --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index b667d6482498..a0d74c287f37 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -4770,8 +4770,8 @@ void PrimaryLogPG::kick_snap_trim() void PrimaryLogPG::snap_trimmer_scrub_complete() { - if (is_primary() && is_active() && is_clean()) { - ceph_assert(!snap_trimq.empty()); + if (is_primary() && is_active() && is_clean() && !snap_trimq.empty()) { + dout(10) << "scrub finished - requeuing snap_trimmer" << dendl; snap_trimmer_machine.process_event(ScrubComplete()); } } diff --git a/src/osd/pg_scrubber.cc b/src/osd/pg_scrubber.cc index 8fb61d4c7a3b..bca92a5f46ff 100644 --- a/src/osd/pg_scrubber.cc +++ b/src/osd/pg_scrubber.cc @@ -179,6 +179,9 @@ void PgScrubber::initiate_regular_scrub(epoch_t epoch_queued) m_fsm->my_states(); m_fsm->process_event(StartScrub{}); dout(10) << "scrubber event --<< StartScrub" << dendl; + } else { + // and just in case snap trimming was blocked by the aborted scrub + m_pg->snap_trimmer_scrub_complete(); } } @@ -192,9 +195,10 @@ void PgScrubber::initiate_scrub_after_repair(epoch_t epoch_queued) m_fsm->my_states(); m_fsm->process_event(AfterRepairScrub{}); dout(10) << "scrubber event --<< AfterRepairScrub" << dendl; + } else { + m_pg->snap_trimmer_scrub_complete(); } } - void PgScrubber::send_scrub_unblock(epoch_t epoch_queued) { dout(10) << "scrubber event -->> " << __func__ << " epoch: " << epoch_queued << dendl; @@ -1783,11 +1787,6 @@ void PgScrubber::scrub_finish() &t); int tr = m_osds->store->queue_transaction(m_pg->ch, std::move(t), nullptr); ceph_assert(tr == 0); - - if (!m_pg->snap_trimq.empty()) { - dout(10) << "scrub finished, requeuing snap_trimmer" << dendl; - m_pg->snap_trimmer_scrub_complete(); - } } if (has_error) { @@ -1807,6 +1806,9 @@ void PgScrubber::scrub_finish() if (m_pg->is_active() && m_pg->is_primary()) { m_pg->recovery_state.share_pg_info(); } + + // we may have blocked the snap trimmer + m_pg->snap_trimmer_scrub_complete(); } void PgScrubber::on_digest_updates()