mirror of
https://github.com/ceph/ceph
synced 2024-12-17 00:46:05 +00:00
librados: fix MWatchNotify leak
Do not leak the message if the watcher is not registered. Also, simplify this block. Fixes (part of): #5949 Backport: dumpling, cuttlefish Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
This commit is contained in:
parent
810c52de36
commit
6f5d8036f3
@ -563,16 +563,13 @@ public:
|
||||
void librados::RadosClient::watch_notify(MWatchNotify *m)
|
||||
{
|
||||
assert(lock.is_locked());
|
||||
WatchContext *wc = NULL;
|
||||
map<uint64_t, WatchContext *>::iterator iter = watchers.find(m->cookie);
|
||||
if (iter != watchers.end())
|
||||
wc = iter->second;
|
||||
|
||||
if (!wc)
|
||||
return;
|
||||
|
||||
wc->get();
|
||||
finisher.queue(new C_WatchNotify(wc, &lock, m->opcode, m->ver, m->notify_id, m->bl));
|
||||
if (iter != watchers.end()) {
|
||||
WatchContext *wc = iter->second;
|
||||
assert(wc);
|
||||
wc->get();
|
||||
finisher.queue(new C_WatchNotify(wc, &lock, m->opcode, m->ver, m->notify_id, m->bl));
|
||||
}
|
||||
m->put();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user