]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: don't prematurely finish snapshot replay loop
authorJason Dillaman <dillaman@redhat.com>
Wed, 18 Mar 2020 18:47:50 +0000 (14:47 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 20 Mar 2020 17:18:13 +0000 (13:18 -0400)
The unlink step was being incorrectly skipped if a state machine
shut down was requested.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc
src/tools/rbd_mirror/image_replayer/snapshot/Replayer.h

index fc62e41611283b71cf36483a5270e5df6a1824e9..55083c610197db2816a2e11250ff84014937c836 100644 (file)
@@ -900,22 +900,13 @@ void Replayer<I>::handle_notify_image_update(int r) {
     derr << "failed to notify local image update: " << cpp_strerror(r) << dendl;
   }
 
-  if (is_replay_interrupted()) {
-    return;
-  }
-
   unlink_peer();
 }
 
 template <typename I>
 void Replayer<I>::unlink_peer() {
   if (m_remote_snap_id_start == 0) {
-    {
-      std::unique_lock locker{m_lock};
-      notify_status_updated();
-    }
-
-    load_local_image_meta();
+    finish_sync();
     return;
   }
 
@@ -942,11 +933,22 @@ void Replayer<I>::handle_unlink_peer(int r) {
     return;
   }
 
+  finish_sync();
+}
+
+template <typename I>
+void Replayer<I>::finish_sync() {
+  dout(10) << dendl;
+
   {
     std::unique_lock locker{m_lock};
     notify_status_updated();
   }
 
+  if (is_replay_interrupted()) {
+    return;
+  }
+
   load_local_image_meta();
 }
 
index fae097b1fcba02b788c18fc8a7f9a71bf29d6fbc..f0b1fccd56be4c4901d0f0c97c8772cf941efcb5 100644 (file)
@@ -263,6 +263,8 @@ private:
   void unlink_peer();
   void handle_unlink_peer(int r);
 
+  void finish_sync();
+
   void register_local_update_watcher();
   void handle_register_local_update_watcher(int r);