]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: AsyncOperation may not be reused
authorMykola Golub <mgolub@suse.com>
Mon, 2 Jul 2018 09:17:08 +0000 (12:17 +0300)
committerJason Dillaman <dillaman@redhat.com>
Tue, 14 Aug 2018 22:29:45 +0000 (18:29 -0400)
Signed-off-by: Mykola Golub <mgolub@suse.com>
src/librbd/operation/MigrateRequest.cc

index f7ec41621d662d6a34cbbb12b152ebd8bdf85b74..18737f01e28648c54451025fb4324f6ef4726ca1 100644 (file)
@@ -58,7 +58,7 @@ private:
   ::SnapContext m_snapc;
   uint64_t m_object_no;
 
-  io::AsyncOperation m_async_op;
+  io::AsyncOperation *m_async_op = nullptr;
 
   void start_async_op() {
     I &image_ctx = this->m_image_ctx;
@@ -66,7 +66,9 @@ private:
     CephContext *cct = image_ctx.cct;
     ldout(cct, 10) << dendl;
 
-    m_async_op.start_op(image_ctx);
+    assert(m_async_op == nullptr);
+    m_async_op = new io::AsyncOperation();
+    m_async_op->start_op(image_ctx);
 
     if (!image_ctx.io_work_queue->writes_blocked()) {
       migrate_object();
@@ -76,7 +78,9 @@ private:
     auto ctx = create_async_context_callback(
       image_ctx, create_context_callback<
         C_MigrateObject<I>, &C_MigrateObject<I>::handle_start_async_op>(this));
-    m_async_op.finish_op();
+    m_async_op->finish_op();
+    delete m_async_op;
+    m_async_op = nullptr;
     image_ctx.io_work_queue->wait_on_writes_unblocked(ctx);
   }
 
@@ -145,7 +149,8 @@ private:
       r = 0;
     }
 
-    m_async_op.finish_op();
+    m_async_op->finish_op();
+    delete m_async_op;
     this->complete(r);
   }
 };