]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scrub: destruct the scrubber shortly before the PG is destructed 45731/head
authorRonen Friedman <rfriedma@redhat.com>
Thu, 26 Aug 2021 12:30:38 +0000 (12:30 +0000)
committerRonen Friedman <rfriedma@redhat.com>
Thu, 31 Mar 2022 11:01:08 +0000 (11:01 +0000)
By destructing the scrubber when the PG is still intact, we guarantee that
Scrubber's code can refer to the PG object - especially in dout()s.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
(cherry picked from commit bcd13e134c1f335506e425800170d55cd8a2af1b)

src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index b667d64824986cc983aab3d829b501eca7425594..0e6d8e8c13292ff8313c5a15ba6e26c6f3adb28b 100644 (file)
@@ -1683,6 +1683,11 @@ PrimaryLogPG::PrimaryLogPG(OSDService *o, OSDMapRef curmap,
   m_scrubber = make_unique<PrimaryLogScrub>(this);
 }
 
+PrimaryLogPG::~PrimaryLogPG()
+{
+  m_scrubber.reset();
+}
+
 void PrimaryLogPG::get_src_oloc(const object_t& oid, const object_locator_t& oloc, object_locator_t& src_oloc)
 {
   src_oloc = oloc;
index ba57dd4f38aa88aac7bf5518d2fc55e1e7780296..9b6c017f3647937aa86ca250cf0852eb3627fbd6 100644 (file)
@@ -1489,7 +1489,7 @@ public:
               const PGPool &_pool,
               const std::map<std::string,std::string>& ec_profile,
               spg_t p);
-  ~PrimaryLogPG() override {}
+  ~PrimaryLogPG() override;
 
   void do_command(
     const std::string_view& prefix,