]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: potential deadlock during AIO image re-open
authorJason Dillaman <dillaman@redhat.com>
Mon, 15 Feb 2016 15:50:33 +0000 (10:50 -0500)
committerJason Dillaman <dillaman@redhat.com>
Mon, 15 Feb 2016 17:35:22 +0000 (12:35 -0500)
The AIO image open might complete under the librados AIO callback.
Attempting to close the old image handle under that thread will
deadlock under the new librados_test_stub flush handling.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/image/RefreshRequest.cc

index 013b1d6baa62bc6da83474cbb46a3fd7fbcc34b8..94dfbddbf7b3bf4260723b873c4a8bc08a1a196d 100644 (file)
@@ -5,6 +5,7 @@
 #include "include/stringify.h"
 #include "common/dout.h"
 #include "common/errno.h"
+#include "common/WorkQueue.h"
 #include "cls/lock/cls_lock_client.h"
 #include "cls/rbd/cls_rbd_client.h"
 #include "librbd/ExclusiveLock.h"
@@ -22,13 +23,15 @@ namespace librbd {
 namespace image {
 
 using util::create_rados_ack_callback;
+using util::create_async_context_callback;
 using util::create_context_callback;
 
 template <typename I>
 RefreshRequest<I>::RefreshRequest(I &image_ctx, Context *on_finish)
-  : m_image_ctx(image_ctx), m_on_finish(on_finish), m_error_result(0),
-    m_flush_aio(false), m_exclusive_lock(nullptr), m_object_map(nullptr),
-    m_journal(nullptr), m_refresh_parent(nullptr) {
+  : m_image_ctx(image_ctx),
+    m_on_finish(create_async_context_callback(m_image_ctx, on_finish)),
+    m_error_result(0), m_flush_aio(false), m_exclusive_lock(nullptr),
+    m_object_map(nullptr), m_journal(nullptr), m_refresh_parent(nullptr) {
 }
 
 template <typename I>