]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: copy operation needs to use AIO work queue for writes 6541/head
authorJason Dillaman <dillaman@redhat.com>
Tue, 17 Nov 2015 14:33:17 +0000 (09:33 -0500)
committerJason Dillaman <dillaman@redhat.com>
Tue, 17 Nov 2015 15:22:26 +0000 (10:22 -0500)
This ensures that the exclusive lock is properly acquired prior to
writing to the new image.

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

index 25d99f43f31884da249904cb67b3673f9f86f5b3..d925b42b229aca49366b014688073d624951f243 100644 (file)
@@ -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;