From: Jason Dillaman Date: Tue, 17 Nov 2015 14:33:17 +0000 (-0500) Subject: librbd: copy operation needs to use AIO work queue for writes X-Git-Tag: v10.0.1~52^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F6541%2Fhead;p=ceph.git 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 --- 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;