From: Sage Weil Date: Mon, 24 Nov 2014 23:58:11 +0000 (-0800) Subject: librados:: carry IoCtx ref from WatchInfo X-Git-Tag: v0.91~73 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a53dbabd762d0dbb704ff709c8888a79614abfdc;p=ceph.git librados:: carry IoCtx ref from WatchInfo The WatchInfo gets totally async notifications. Make sure our ioctx ref is valid when that happens. Signed-off-by: Sage Weil --- diff --git a/src/librados/IoCtxImpl.cc b/src/librados/IoCtxImpl.cc index 6c43aa177c1b..25f956210b15 100644 --- a/src/librados/IoCtxImpl.cc +++ b/src/librados/IoCtxImpl.cc @@ -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,