From f92f7417aec3c26376832877b31a0635d091359e Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 17 Nov 2015 09:33:17 -0500 Subject: [PATCH] librbd: copy operation needs to use AIO work queue for writes This ensures that the exclusive lock is properly acquired prior to writing to the new image. Signed-off-by: Jason Dillaman --- src/librbd/internal.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 25d99f43f31..d925b42b229 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -2962,13 +2962,15 @@ reprotect_and_return_err: return; } - RWLock::RLocker owner_lock(m_dest->owner_lock); Context *ctx = new C_CopyWrite(m_throttle, m_bl); AioCompletion *comp = aio_create_completion_internal(ctx, rbd_ctx_cb); - AioImageRequest::aio_write(m_dest, comp, m_offset, m_bl->length(), - m_bl->c_str(), - LIBRADOS_OP_FLAG_FADVISE_DONTNEED); + + // coordinate through AIO WQ to ensure lock is acquired if needed + m_dest->aio_work_queue->aio_write(comp, m_offset, m_bl->length(), + m_bl->c_str(), + LIBRADOS_OP_FLAG_FADVISE_DONTNEED); } + private: SimpleThrottle *m_throttle; ImageCtx *m_dest; -- 2.47.3