diff options
author | Sage Weil <sage@inktank.com> | 2012-07-05 18:08:58 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-07-26 15:03:35 -0700 |
commit | 7fbbe4652ffb2826978aa1f1cacce4456d2ef1fc (patch) | |
tree | d9e583e5eb9a7a9da01c658582a1f489f733900d /src/librados | |
parent | 6ed01df412b4f4745c8f427a94446987c88b6bef (diff) | |
download | ceph-7fbbe4652ffb2826978aa1f1cacce4456d2ef1fc.tar.gz |
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 <sage@inktank.com>
Diffstat (limited to 'src/librados')
-rw-r--r-- | src/librados/IoCtxImpl.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/librados/IoCtxImpl.cc b/src/librados/IoCtxImpl.cc index 3eea6b4a1f9..9b59f7ddf2d 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 /////////////////////////////// |