]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: fix possible deadlock in librbd ImageWatcher tests
authorJason Dillaman <dillaman@redhat.com>
Tue, 12 May 2015 14:07:21 +0000 (10:07 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 4 Jun 2015 20:52:05 +0000 (16:52 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/ImageCtx.cc
src/test/librbd/test_ImageWatcher.cc

index d904ec29b6476e45b4fe2bb8b61d280d49a69130..7f74ec01869364ed8dcb7e5057f83044b9af908c 100644 (file)
@@ -693,7 +693,7 @@ public:
 
   void ImageCtx::invalidate_cache(Context *on_finish) {
     if (object_cacher == NULL) {
-      on_finish->complete(0);
+      op_work_queue->queue(on_finish, 0);
       return;
     }
 
index b87ccd400ca023a67d524e6171bdca42d53b6658..da84093f612a5da3ebb18cb85b6a070ea1d9b949 100644 (file)
@@ -164,10 +164,10 @@ public:
 
   int handle_restart_aio(librbd::ImageCtx *ictx,
                         librbd::AioCompletion *aio_completion) {
-    Mutex::Locker l1(m_callback_lock);
+    Mutex::Locker callback_locker(m_callback_lock);
     ++m_aio_completion_restarts;
 
-    RWLock::WLocker l2(ictx->owner_lock);
+    RWLock::RLocker owner_locker(ictx->owner_lock);
     if (!ictx->image_watcher->is_lock_owner() &&
         (m_expected_aio_restarts == 0 ||
         m_aio_completion_restarts < m_expected_aio_restarts)) {
@@ -176,7 +176,7 @@ public:
        aio_completion);
     } else {
       {
-       Mutex::Locker l2(aio_completion->lock);
+       Mutex::Locker completion_locker(aio_completion->lock);
        aio_completion->complete(ictx->cct);
       }