From a53dbabd762d0dbb704ff709c8888a79614abfdc Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 24 Nov 2014 15:58:11 -0800 Subject: [PATCH] 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 --- src/librados/IoCtxImpl.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/librados/IoCtxImpl.cc b/src/librados/IoCtxImpl.cc index 6c43aa177c1..25f956210b1 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, -- 2.47.3