]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: adding safety checks when accessing m_scrubber 38730/head
authorRonen Friedman <rfriedma@redhat.com>
Wed, 13 Jan 2021 12:13:56 +0000 (14:13 +0200)
committerRonen Friedman <rfriedma@redhat.com>
Wed, 13 Jan 2021 18:30:06 +0000 (20:30 +0200)
Verifying m_scrubber is there if accessed in a scenario that
might coincide with PG removal.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/osd/PG.cc
src/osd/PrimaryLogPG.cc
src/osd/pg_scrubber.cc

index 960d068d300848f60032a47e75628dd55a91570c..9a38b3866629d4ec31c622c270f107b8dc922334 100644 (file)
@@ -2584,7 +2584,7 @@ void PG::handle_query_state(Formatter *f)
 
   // This code has moved to after the close of recovery_state array.
   // I don't think that scrub is a recovery state
-  if (is_primary() && is_active() && m_scrubber->is_scrub_active()) {
+  if (is_primary() && is_active() && m_scrubber && m_scrubber->is_scrub_active()) {
     m_scrubber->handle_query_state(f);
   }
 }
index c0fbdd342a5c49ff659d1d12cc35054b82ea2a0f..4427bff8249e2444c93c8a1aa090f29e4ea825e8 100644 (file)
@@ -1014,7 +1014,7 @@ void PrimaryLogPG::do_command(
     handle_query_state(f.get());
     f->close_section();
 
-    if (is_primary() && is_active()) {
+    if (is_primary() && is_active() && m_scrubber) {
       m_scrubber->dump(f.get());
     }
 
@@ -1603,7 +1603,7 @@ int PrimaryLogPG::do_scrub_ls(const MOSDOp *m, OSDOp *osd_op)
   if (arg.interval != 0 && arg.interval != info.history.same_interval_since) {
     r = -EAGAIN;
   } else {
-    bool store_queried = m_scrubber->get_store_errors(arg, result);
+    bool store_queried = m_scrubber && m_scrubber->get_store_errors(arg, result);
     if (store_queried) {
       encode(result, osd_op->outdata); 
     } else {
@@ -1846,6 +1846,10 @@ void PrimaryLogPG::do_request(
 
   case MSG_OSD_SCRUB_RESERVE:
     {
+      if (!m_scrubber) {
+        osd->reply_op_error(op, -EAGAIN);
+        return;
+      }
       auto m = op->get_req<MOSDScrubReserve>();
       switch (m->type) {
       case MOSDScrubReserve::REQUEST:
index 578a2cf3407da2297e2a626d3c1d26abe0f7d923..0eb513714e270799e0aaf80bc04f80fba2e1e769 100644 (file)
@@ -1890,8 +1890,6 @@ namespace Scrub {
 
 void ReplicaReservations::release_replica(pg_shard_t peer, epoch_t epoch)
 {
-  dout(15) << __func__ << " <ReplicaReservations> release-> " << peer << dendl;
-
   auto m = new MOSDScrubReserve(spg_t(m_pg->info.pgid.pgid, peer.shard), epoch,
                                MOSDScrubReserve::RELEASE, m_pg->pg_whoami);
   m_osds->send_message_osd_cluster(peer.osd, m, epoch);