From: Jason Dillaman Date: Mon, 15 Feb 2016 15:50:33 +0000 (-0500) Subject: librbd: potential deadlock during AIO image re-open X-Git-Tag: v10.1.0~377^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f5dfebc026e5d914b0d3aa5082a0d8a1ed28c794;p=ceph.git librbd: potential deadlock during AIO image re-open 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 --- diff --git a/src/librbd/image/RefreshRequest.cc b/src/librbd/image/RefreshRequest.cc index 013b1d6baa62..94dfbddbf7b3 100644 --- a/src/librbd/image/RefreshRequest.cc +++ b/src/librbd/image/RefreshRequest.cc @@ -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 RefreshRequest::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