The WatchInfo gets totally async notifications. Make sure our ioctx
ref is valid when that happens.
Signed-off-by: Sage Weil <sage@redhat.com>
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,