]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: ensure aio_write buffer isn't invalidated during image import
authorJason Dillaman <dillaman@redhat.com>
Wed, 21 Jan 2015 19:55:02 +0000 (14:55 -0500)
committerJosh Durgin <jdurgin@redhat.com>
Wed, 21 Jan 2015 20:23:16 +0000 (12:23 -0800)
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>
src/rbd.cc

index 453fea0a85d94ad0cec2d3b9dc7ed20034567324..8a346c67600218b4256056b4d27b2281df3c6164 100644 (file)
@@ -1365,11 +1365,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);
@@ -1401,6 +1402,7 @@ public:
 private:
   SimpleThrottle &m_throttle;
   librbd::RBD::AioCompletion *m_aio_completion;
+  bufferlist m_bufferlist;
   uint64_t m_offset;
 };