]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/d4n: passing the dpp to RedisPool::acquire to fix nullptr crash 66845/head
authorgal salomon <gal.salomon@gmail.com>
Thu, 8 Jan 2026 18:46:55 +0000 (18:46 +0000)
committergal salomon <gal.salomon@gmail.com>
Thu, 8 Jan 2026 18:46:55 +0000 (18:46 +0000)
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 <gal.salomon@gmail.com>
src/rgw/driver/d4n/d4n_directory.cc
src/rgw/driver/d4n/d4n_directory.h

index efc30293dc51ad47228b08bfd863616f28a02d4a..daadabed8dbc011d8442faf9ccacb8aeb78d59de 100644 (file)
@@ -51,14 +51,15 @@ void redis_exec(std::shared_ptr<connection> conn,
 }
 
 template <typename... Types>
-void redis_exec_cp(std::shared_ptr<rgw::d4n::RedisPool> pool,
+void redis_exec_cp(const DoutPrefixProvider* dpp,
+                std::shared_ptr<rgw::d4n::RedisPool> pool,
                 boost::system::error_code& ec,
                 const boost::redis::request& req,
                 boost::redis::response<Types...>& resp,
                optional_yield y)
 {
 //purpose: Execute a Redis command using a connection from the pool
-       std::shared_ptr<connection> conn = pool->acquire();
+       std::shared_ptr<connection> conn = pool->acquire(dpp);
        try {
 
                if (y) {
@@ -89,13 +90,14 @@ void redis_exec(std::shared_ptr<connection> conn,
   }
 }
 
-void redis_exec_cp(std::shared_ptr<rgw::d4n::RedisPool> pool,
+void redis_exec_cp(const DoutPrefixProvider* dpp,
+                std::shared_ptr<rgw::d4n::RedisPool> 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<connection> conn = pool->acquire();
+       std::shared_ptr<connection> 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 <typename... Types>
@@ -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)
index 26c899d2275e7dadbf791004a1eb43b5c04618f9..f20cb00d9b2a823cdf9cce85c2027e2e28cebf05 100644 (file)
@@ -34,7 +34,7 @@ public:
       cancel_all();
     }
 
-    std::shared_ptr<connection> acquire() {
+    std::shared_ptr<connection> acquire(const DoutPrefixProvider* dpp = nullptr) {
         std::unique_lock<std::mutex> 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;