]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: ensure aio_write buffer isn't invalidated during image import 3443/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 21 Jan 2015 19:55:02 +0000 (14:55 -0500)
committerJason Dillaman <dillaman@redhat.com>
Wed, 21 Jan 2015 20:28:16 +0000 (15:28 -0500)
The buffer provided to aio_write shouldn't be invalidated until
after aio_write has indicated that the operation has completed.

Fixes: #10590
Backport: giant
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Reviewed-by: Josh Durgin <jdurgin@redhat.com>
(cherry picked from commit 4d3b49e9d62bc1040356ca3ebe7f90c181734eb6)

src/rbd.cc

index 9c7bb4934b4649b15fa114dff80524a95298b6ce..ba592310476e55ea5f3a4169721705e664491fc3 100644 (file)
@@ -1331,11 +1331,12 @@ public:
     : m_throttle(simple_throttle),
       m_aio_completion(
         new librbd::RBD::AioCompletion(this, &AioImportContext::aio_callback)),
-      m_offset(offset)
+      m_bufferlist(bl), m_offset(offset)
   {
     m_throttle.start_op();
 
-    int r = image.aio_write(m_offset, bl.length(), bl, m_aio_completion);
+    int r = image.aio_write(m_offset, m_bufferlist.length(), m_bufferlist,
+                           m_aio_completion);
     if (r < 0) {
       cerr << "rbd: error requesting write to destination image" << std::endl;
       m_throttle.end_op(r);
@@ -1367,6 +1368,7 @@ public:
 private:
   SimpleThrottle &m_throttle;
   librbd::RBD::AioCompletion *m_aio_completion;
+  bufferlist m_bufferlist;
   uint64_t m_offset;
 };