From b5693a6ecb7e5b620eae8f02673e1346c2fd8825 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 5 Jul 2012 18:08:58 -0700 Subject: [PATCH] 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 --- src/librados/IoCtxImpl.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librados/IoCtxImpl.cc b/src/librados/IoCtxImpl.cc index 0fd7575ca3042..cb30aa8bf0d7f 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 /////////////////////////////// -- 2.39.5