From c83a31e9004a93bf955962691386211975bcc6f8 Mon Sep 17 00:00:00 2001 From: Nithya Balachandran Date: Tue, 10 Feb 2026 15:53:20 +0000 Subject: [PATCH] rgw: do not re-init Rados in RadosRealmWatcher The RadosRealmWatcher::watch_start() function incorrectly reinitialized a rados client that had already been initialized during the creation of the ConfigStore. This caused the original Objecter to be lost, which was subsequently reported as a memory leak by Valgrind. Signed-off-by: Nithya Balachandran --- src/rgw/driver/rados/config/realm_watcher.cc | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/rgw/driver/rados/config/realm_watcher.cc b/src/rgw/driver/rados/config/realm_watcher.cc index 0d6fb0cd2b6..d06bbe3f8ec 100644 --- a/src/rgw/driver/rados/config/realm_watcher.cc +++ b/src/rgw/driver/rados/config/realm_watcher.cc @@ -85,23 +85,10 @@ int RadosRealmWatcher::watch_start(const DoutPrefixProvider* dpp, librados::Rados& rados, const RGWRealm& realm) { - // initialize a Rados client - int r = rados.init_with_context(cct); - if (r < 0) { - ldpp_dout(dpp, -1) << "Rados client initialization failed with " - << cpp_strerror(-r) << dendl; - return r; - } - r = rados.connect(); - if (r < 0) { - ldpp_dout(dpp, -1) << "Rados client connection failed with " - << cpp_strerror(-r) << dendl; - return r; - } - + // The Rados client should have been initialized by the ConfigStore // open an IoCtx for the realm's pool rgw_pool pool(realm.get_pool(cct)); - r = rgw_init_ioctx(dpp, &rados, pool, pool_ctx); + int r = rgw_init_ioctx(dpp, &rados, pool, pool_ctx); if (r < 0) { ldpp_dout(dpp, -1) << "Failed to open pool " << pool << " with " << cpp_strerror(-r) << dendl; -- 2.47.3