From e3bc89028955c060a0157ecf1c87ce87903d1b20 Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Thu, 26 Aug 2021 12:30:38 +0000 Subject: [PATCH] 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) --- src/osd/PrimaryLogPG.cc | 5 +++++ src/osd/PrimaryLogPG.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index b667d64824986..0e6d8e8c13292 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 ba57dd4f38aa8..9b6c017f36479 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, -- 2.39.5