From: Ronen Friedman Date: Thu, 26 Aug 2021 12:30:38 +0000 (+0000) Subject: osd/scrub: destruct the scrubber shortly before the PG is destructed X-Git-Tag: v16.2.8~31^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F45731%2Fhead;p=ceph.git osd/scrub: destruct the scrubber shortly before the PG is destructed 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 (cherry picked from commit bcd13e134c1f335506e425800170d55cd8a2af1b) --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index b667d6482498..0e6d8e8c1329 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -1683,6 +1683,11 @@ PrimaryLogPG::PrimaryLogPG(OSDService *o, OSDMapRef curmap, m_scrubber = make_unique(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; diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index ba57dd4f38aa..9b6c017f3647 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1489,7 +1489,7 @@ public: const PGPool &_pool, const std::map& ec_profile, spg_t p); - ~PrimaryLogPG() override {} + ~PrimaryLogPG() override; void do_command( const std::string_view& prefix,