From: Sage Weil Date: Fri, 6 Jul 2012 01:08:58 +0000 (-0700) Subject: librados: take lock when signaling notify cond X-Git-Tag: v0.50~107^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b5693a6ecb7e5b620eae8f02673e1346c2fd8825;p=ceph.git librados: take lock when signaling notify cond When we are signaling the cond to indicate that a notify is complete, take the appropriate lock. This removes the possibility of a race that loses our signal. (That would be very difficult given that there are network round trips involved, but this makes the lock/cond usage "correct.") Signed-off-by: Sage Weil --- diff --git a/src/librados/IoCtxImpl.cc b/src/librados/IoCtxImpl.cc index 0fd7575ca304..cb30aa8bf0d7 100644 --- a/src/librados/IoCtxImpl.cc +++ b/src/librados/IoCtxImpl.cc @@ -1600,8 +1600,10 @@ void librados::IoCtxImpl::C_NotifyComplete::notify(uint8_t opcode, uint64_t ver, bufferlist& bl) { + lock->Lock(); *done = true; cond->Signal(); + lock->Unlock(); } /////////////////////////// WatchContext ///////////////////////////////