From: Jason Dillaman Date: Mon, 15 Feb 2016 17:30:41 +0000 (-0500) Subject: librados_test_stub: watch_flush should block until notifies complete X-Git-Tag: v10.1.0~377^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F7653%2Fhead;p=ceph.git librados_test_stub: watch_flush should block until notifies complete It shouldn't block until all the acks are received as that is not how librados handles the method. Signed-off-by: Jason Dillaman --- diff --git a/src/test/librados_test_stub/TestWatchNotify.cc b/src/test/librados_test_stub/TestWatchNotify.cc index 7bd2ef722bbd..a35d081ce271 100644 --- a/src/test/librados_test_stub/TestWatchNotify.cc +++ b/src/test/librados_test_stub/TestWatchNotify.cc @@ -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