]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: wait for in-flight start/stop/restart 34931/head
authorMykola Golub <mgolub@suse.com>
Tue, 5 May 2020 14:26:39 +0000 (15:26 +0100)
committerMykola Golub <mgolub@suse.com>
Tue, 19 May 2020 14:57:22 +0000 (15:57 +0100)
when stopping instance replayer on shut down.

Signed-off-by: Mykola Golub <mgolub@suse.com>
src/tools/rbd_mirror/InstanceReplayer.cc

index 95bb67129ddb6c7749c3fdd104b8b9a184d0cc6e..4ef838fa43ebbfcd1671d07231b01b153c7d035a 100644 (file)
@@ -274,9 +274,17 @@ void InstanceReplayer<I>::stop(Context *on_finish)
 {
   dout(10) << dendl;
 
+  if (on_finish == nullptr) {
+    on_finish = new C_TrackedOp(m_async_op_tracker, on_finish);
+  } else {
+    on_finish = new LambdaContext(
+      [this, on_finish] (int r) {
+        m_async_op_tracker.wait_for_ops(on_finish);
+      });
+  }
+
   auto cct = static_cast<CephContext *>(m_local_io_ctx.cct());
-  auto gather_ctx = new C_Gather(
-    cct, new C_TrackedOp(m_async_op_tracker, on_finish));
+  auto gather_ctx = new C_Gather(cct, on_finish);
   {
     std::lock_guard locker{m_lock};