]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados:: carry IoCtx ref from WatchInfo
authorSage Weil <sage@redhat.com>
Mon, 24 Nov 2014 23:58:11 +0000 (15:58 -0800)
committerSage Weil <sage@redhat.com>
Thu, 4 Dec 2014 18:39:21 +0000 (10:39 -0800)
The WatchInfo gets totally async notifications.  Make sure our ioctx
ref is valid when that happens.

Signed-off-by: Sage Weil <sage@redhat.com>
src/librados/IoCtxImpl.cc

index 6c43aa177c1b0cedcd1c709a7e3e686bec516a5c..25f956210b152df19e6241386f1e1d5ae868f786 100644 (file)
@@ -1040,7 +1040,12 @@ struct WatchInfo : public Objecter::WatchContext {
 
   WatchInfo(librados::IoCtxImpl *io, object_t o,
            librados::WatchCtx *c, librados::WatchCtx2 *c2)
-    : ioctx(io), oid(o), ctx(c), ctx2(c2) {}
+    : ioctx(io), oid(o), ctx(c), ctx2(c2) {
+    ioctx->get();
+  }
+  ~WatchInfo() {
+    ioctx->put();
+  }
 
   void handle_notify(uint64_t notify_id,
                     uint64_t cookie,