]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RadosClient: Fixing potential lock leaks.
authorPavan Rallabhandi <pavan.rallabhandi@sandisk.com>
Wed, 6 Aug 2014 09:40:14 +0000 (15:10 +0530)
committerSage Weil <sage@redhat.com>
Tue, 12 Aug 2014 22:01:00 +0000 (15:01 -0700)
In lookup_pool and pool_delete, a lock is taken
before invoking wait_for_osdmap, but is not
released for the failure case of the call. Fixing the same.

Fixes: #9022
Signed-off-by: Pavan Rallabhandi <pavan.rallabhandi@sandisk.com>
(cherry picked from commit f1aad8bcfc53f982130dbb3243660c3c546c3523)

src/librados/RadosClient.cc

index 249c34f564f00f8379ea7f4ba848abe26b07774d..9330e65368048407d728ca50e39e2bd6d4a8b111 100644 (file)
@@ -103,8 +103,10 @@ int64_t librados::RadosClient::lookup_pool(const char *name)
   lock.Lock();
 
   int r = wait_for_osdmap();
-  if (r < 0)
+  if (r < 0) {
+    lock.Unlock();
     return r;
+  }
   int64_t ret = osdmap.lookup_pg_pool_name(name);
   pool_cache_rwl.get_write();
   lock.Unlock();
@@ -582,8 +584,10 @@ int librados::RadosClient::pool_delete(const char *name)
 {
   lock.Lock();
   int r = wait_for_osdmap();
-  if (r < 0)
+  if (r < 0) {
+    lock.Unlock();
     return r;
+  }
   int tmp_pool_id = osdmap.lookup_pg_pool_name(name);
   if (tmp_pool_id < 0) {
     lock.Unlock();