]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados_test_stub: watch_flush should block until notifies complete 7653/head
authorJason Dillaman <dillaman@redhat.com>
Mon, 15 Feb 2016 17:30:41 +0000 (12:30 -0500)
committerJason Dillaman <dillaman@redhat.com>
Mon, 15 Feb 2016 17:36:00 +0000 (12:36 -0500)
It shouldn't block until all the acks are received as that is not
how librados handles the method.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/librados_test_stub/TestWatchNotify.cc

index 7bd2ef722bbd10ae6d81efb194b882310c4cd67e..a35d081ce2713a4481ff45232508267fca8255af 100644 (file)
@@ -21,6 +21,7 @@ TestWatchNotify::~TestWatchNotify() {
 }
 
 void TestWatchNotify::flush() {
+  // block until we know no additional async notify callbacks will occur
   Mutex::Locker locker(m_lock);
   while (m_pending_notifies > 0) {
     m_file_watcher_cond.Wait(m_lock);
@@ -176,6 +177,10 @@ void TestWatchNotify::execute_notify(const std::string &oid,
   }
 
   finish_notify(oid, notify_id);
+
+  if (--m_pending_notifies == 0) {
+    m_file_watcher_cond.Signal();
+  }
 }
 
 void TestWatchNotify::ack_notify(const std::string &oid,
@@ -226,10 +231,6 @@ void TestWatchNotify::finish_notify(const std::string &oid,
   if (watcher->watch_handles.empty() && watcher->notify_handles.empty()) {
     m_file_watchers.erase(oid);
   }
-
-  if (--m_pending_notifies == 0) {
-    m_file_watcher_cond.Signal();
-  }
 }
 
 } // namespace librados