]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scrub: restart snap trimming only after scrubbing is done 45641/head
authorRonen Friedman <rfriedma@redhat.com>
Fri, 25 Mar 2022 10:45:47 +0000 (10:45 +0000)
committerRonen Friedman <rfriedma@redhat.com>
Fri, 25 Mar 2022 12:03:11 +0000 (12:03 +0000)
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 <rfriedma@redhat.com>
(cherry picked from commit 948d3266c67bf896d1c20472977b849178d233d3)

src/osd/PrimaryLogPG.cc
src/osd/scrubber/pg_scrubber.cc

index 02c3bef364f4728d2f7e2a337638cb3a9096a9b8..4fde8b560d6388ab890752484f03c054f69c091f 100644 (file)
@@ -4914,8 +4914,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());
   }
 }
index bd615a97476b3006f3029c0063ad0908774a852c..60582664afddb43bccb119e10bb75bad5aad33f2 100644 (file)
@@ -189,6 +189,8 @@ void PgScrubber::initiate_regular_scrub(epoch_t epoch_queued)
     dout(10) << "scrubber event --<< StartScrub" << dendl;
   } else {
     clear_queued_or_active();
+    // and just in case snap trimming was blocked by the aborted scrub
+    m_pg->snap_trimmer_scrub_complete();
   }
 }
 
@@ -203,6 +205,8 @@ void PgScrubber::initiate_scrub_after_repair(epoch_t epoch_queued)
     dout(10) << "scrubber event --<< AfterRepairScrub" << dendl;
   } else {
     clear_queued_or_active();
+    // and just in case snap trimming was blocked by the aborted scrub
+    m_pg->snap_trimmer_scrub_complete();
   }
 }
 
@@ -1898,11 +1902,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) {
@@ -1922,6 +1921,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()