]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/condition_variable_debug: fix wait hooks 24528/head
authorSage Weil <sage@redhat.com>
Mon, 15 Oct 2018 15:26:31 +0000 (10:26 -0500)
committerSage Weil <sage@redhat.com>
Mon, 15 Oct 2018 15:26:31 +0000 (10:26 -0500)
The post_lock hook needs to be called even with the cond times out, because
the lock is still locked at that point.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/condition_variable_debug.cc

index ae5b7d25134a1193def147f30e34e5f44d7f74d6..a2ddd7691a7de5f405da166797717eeb49957cb4 100644 (file)
@@ -63,9 +63,9 @@ std::cv_status condition_variable_debug::_wait_until(mutex_debug* mutex,
 
   waiter_mutex->_pre_unlock();
   int r = pthread_cond_timedwait(&cond, waiter_mutex->native_handle(), ts);
+  waiter_mutex->_post_lock();
   switch (r) {
   case 0:
-    waiter_mutex->_post_lock();
     return std::cv_status::no_timeout;
   case ETIMEDOUT:
     return std::cv_status::timeout;