From 06188d0b2057e3242e2f69824bf52f23ccf868fa Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Tue, 2 Dec 2025 16:19:05 -0500 Subject: [PATCH] rgw/rados: fix init/shutdown order for RGWIndexCompletionManager RGWRados::init_complete() initializes this RGWIndexCompletionManager after starting some background threads that depend on it, like RGWLC and RGWDataSyncProcessorThread and RGWObjectExpirer. this can lead to a crash when accessing a null index_completion_manager RGWRados::finalize() deletes it before stopping the Restore thread Fixes: https://tracker.ceph.com/issues/74067 Reported-by: J. Eric Ivancich Signed-off-by: Casey Bodley --- src/rgw/driver/rados/rgw_rados.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index baf15ba009c5d..7da31a87a723b 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -1143,7 +1143,6 @@ void RGWRados::finalize() reshard->stop_processor(); } delete reshard; - delete index_completion_manager; if (run_notification_thread) { rgw::notify::shutdown(); @@ -1158,6 +1157,7 @@ void RGWRados::finalize() restore->stop_processor(); } restore = NULL; + delete index_completion_manager; } /** @@ -1287,6 +1287,8 @@ int RGWRados::init_complete(const DoutPrefixProvider *dpp, optional_yield y, rgw pools_initialized = true; + index_completion_manager = new RGWIndexCompletionManager(this); + if (use_gc) { gc = new RGWGC(); gc->initialize(cct, this, y); @@ -1435,8 +1437,6 @@ int RGWRados::init_complete(const DoutPrefixProvider *dpp, optional_yield y, rgw reshard->start_processor(); } - index_completion_manager = new RGWIndexCompletionManager(this); - if (run_bucket_logging_thread) { if (!rgw::bucketlogging::init(dpp, this->driver, *svc.site)) { ldpp_dout(dpp, 0) << "ERROR: failed to initialize bucket logging manager" << dendl; -- 2.39.5