]> 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>
Tue, 28 Jul 2015 20:36:35 +0000 (16:36 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 742a85d667b26b3490d96270b5c500b08f2a5283)

src/librbd/ImageCtx.cc
src/test/librbd/test_ImageWatcher.cc

index ec2ce18cb170469cdaf3b4fab8d94dffae33117c..fd1fe5b76a1be383d2ea6473ecc0beee0ba249fb 100644 (file)
@@ -709,7 +709,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 99a100259b3a8be7840f27d9023b5cf0faf52565..55f0236be4a28cf7e1772f2d7595f62b8fcb5690 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);
       }