]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: fix notify deadlock
authorJosh Durgin <josh.durgin@dreamhost.com>
Mon, 1 Aug 2011 17:45:19 +0000 (10:45 -0700)
committerJosh Durgin <josh.durgin@dreamhost.com>
Tue, 2 Aug 2011 21:17:15 +0000 (14:17 -0700)
The success of the notify call needs to checked before waiting to
receive a notification. If we try notifying on an object that does not
exist, for example, it should fail with -ENOENT, and not hang.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
src/librados.cc

index 53b4dab0deaf49589dd1adc7a0a03c91bcc98abf..b736974fffa289fcd7076b773140d2cb8b1241ba 100644 (file)
@@ -2352,8 +2352,11 @@ notify(IoCtxImpl& io, const object_t& oid, uint64_t ver, bufferlist& bl)
     cond.Wait(mylock);
   mylock.Unlock();
 
-  while (!done_all)
-    cond_all.Wait(mylock_all);
+  if (r == 0) {
+    while (!done_all)
+      cond_all.Wait(mylock_all);
+  }
+
   mylock_all.Unlock();
 
   lock.Lock();