]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: drop reference to completion in container destructor
authorYehuda Sadeh <yehuda@inktank.com>
Thu, 3 Oct 2013 18:49:33 +0000 (11:49 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Fri, 11 Oct 2013 21:53:25 +0000 (14:53 -0700)
Move the PoolAsyncCompletionImpl reference drop from
C_PoolAsync_Safe::finish() to ~C_PoolAsyncSafe(), as finish() is only
called when the async request is actually sent.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
src/librados/PoolAsyncCompletionImpl.h

index efb896414662251a375e7442b02606cdf2faee04..443b2c23a17c8bf50fba93dee27f95da2837ca62 100644 (file)
@@ -94,6 +94,9 @@ namespace librados {
     C_PoolAsync_Safe(PoolAsyncCompletionImpl *_c) : c(_c) {
       c->get();
     }
+    ~C_PoolAsync_Safe() {
+      c->put();
+    }
   
     void finish(int r) {
       c->lock.Lock();
@@ -109,7 +112,7 @@ namespace librados {
        c->lock.Lock();
       }
 
-      c->put_unlock();
+      c->lock.Unlock();
     }
   };
 }