From: gal salomon Date: Thu, 8 Jan 2026 18:46:55 +0000 (+0000) Subject: rgw/d4n: passing the dpp to RedisPool::acquire to fix nullptr crash X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F66845%2Fhead;p=ceph.git rgw/d4n: passing the dpp to RedisPool::acquire to fix nullptr crash Fix segfault when Redis connection pool is exhausted by passing the DoutPrefixProvider parameter through redis_exec_cp() to acquire(), preventing null reference in maybe_warn_about_blocking() Signed-off-by: gal salomon --- diff --git a/src/rgw/driver/d4n/d4n_directory.cc b/src/rgw/driver/d4n/d4n_directory.cc index efc30293dc5..daadabed8db 100644 --- a/src/rgw/driver/d4n/d4n_directory.cc +++ b/src/rgw/driver/d4n/d4n_directory.cc @@ -51,14 +51,15 @@ void redis_exec(std::shared_ptr conn, } template -void redis_exec_cp(std::shared_ptr pool, +void redis_exec_cp(const DoutPrefixProvider* dpp, + std::shared_ptr pool, boost::system::error_code& ec, const boost::redis::request& req, boost::redis::response& resp, optional_yield y) { //purpose: Execute a Redis command using a connection from the pool - std::shared_ptr conn = pool->acquire(); + std::shared_ptr conn = pool->acquire(dpp); try { if (y) { @@ -89,13 +90,14 @@ void redis_exec(std::shared_ptr conn, } } -void redis_exec_cp(std::shared_ptr pool, +void redis_exec_cp(const DoutPrefixProvider* dpp, + std::shared_ptr pool, boost::system::error_code& ec, const boost::redis::request& req, boost::redis::generic_response& resp, optional_yield y) { //purpose: Execute a Redis command using a connection from the pool - std::shared_ptr conn = pool->acquire(); + std::shared_ptr conn = pool->acquire(dpp); try { if (y) { @@ -136,7 +138,7 @@ void redis_exec_connection_pool(const DoutPrefixProvider* dpp, ldpp_dout(dpp, 0) << "Directory::" << __func__ << " not using connection-pool, it's using the shared connection " << dendl; } else[[likely]] - redis_exec_cp(redis_pool, ec, req, resp, y); + redis_exec_cp(dpp, redis_pool, ec, req, resp, y); } template @@ -154,7 +156,7 @@ void redis_exec_connection_pool(const DoutPrefixProvider* dpp, ldpp_dout(dpp, 0) << "Directory::" << __func__ << " not using connection-pool, it's using the shared connection " << dendl; } else[[likely]] - redis_exec_cp(redis_pool, ec, req, resp, y); + redis_exec_cp(dpp, redis_pool, ec, req, resp, y); } int BucketDirectory::zadd(const DoutPrefixProvider* dpp, const std::string& bucket_id, double score, const std::string& member, optional_yield y, Pipeline* pipeline) diff --git a/src/rgw/driver/d4n/d4n_directory.h b/src/rgw/driver/d4n/d4n_directory.h index 26c899d2275..f20cb00d9b2 100644 --- a/src/rgw/driver/d4n/d4n_directory.h +++ b/src/rgw/driver/d4n/d4n_directory.h @@ -34,7 +34,7 @@ public: cancel_all(); } - std::shared_ptr acquire() { + std::shared_ptr acquire(const DoutPrefixProvider* dpp = nullptr) { std::unique_lock lock(m_aquire_release_mtx); if (!m_is_pool_connected) { @@ -46,10 +46,12 @@ public: } if (m_pool.empty()) { - maybe_warn_about_blocking(nullptr); + if (dpp) { + maybe_warn_about_blocking(dpp); + } //wait until m_pool is not empty m_cond_var.wait(lock, [this] { return !m_pool.empty(); }); - } + } auto conn = m_pool.front(); m_pool.pop_front(); return conn;