]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: take lock when signaling notify cond
authorSage Weil <sage@inktank.com>
Fri, 6 Jul 2012 01:08:58 +0000 (18:08 -0700)
committerSage Weil <sage@inktank.com>
Wed, 11 Jul 2012 01:18:28 +0000 (18:18 -0700)
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 <sage@inktank.com>
src/librados/IoCtxImpl.cc

index 0fd7575ca3042184ce15aa06f9e52b50cf8ddca6..cb30aa8bf0d7f71e2a31a2b699b58e49d7d9bed0 100644 (file)
@@ -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 ///////////////////////////////