From 4d3b49e9d62bc1040356ca3ebe7f90c181734eb6 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 21 Jan 2015 14:55:02 -0500 Subject: [PATCH] rbd: ensure aio_write buffer isn't invalidated during image import 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 Reviewed-by: Josh Durgin --- src/rbd.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rbd.cc b/src/rbd.cc index 453fea0a85d..8a346c67600 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -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; }; -- 2.47.3