From: Jason Dillaman Date: Tue, 12 May 2015 14:07:21 +0000 (-0400) Subject: tests: fix possible deadlock in librbd ImageWatcher tests X-Git-Tag: v0.94.4~77^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a88b180571cb481a31cb94c249a3b486220232fa;p=ceph.git tests: fix possible deadlock in librbd ImageWatcher tests Signed-off-by: Jason Dillaman (cherry picked from commit 742a85d667b26b3490d96270b5c500b08f2a5283) --- diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index ec2ce18cb170..fd1fe5b76a1b 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -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; } diff --git a/src/test/librbd/test_ImageWatcher.cc b/src/test/librbd/test_ImageWatcher.cc index 99a100259b3a..55f0236be4a2 100644 --- a/src/test/librbd/test_ImageWatcher.cc +++ b/src/test/librbd/test_ImageWatcher.cc @@ -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); }