]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd-mirror: move resetting of snapshot replayer rescan variable
authorJason Dillaman <dillaman@redhat.com>
Mon, 2 Mar 2020 20:34:22 +0000 (15:34 -0500)
committerJason Dillaman <dillaman@redhat.com>
Mon, 2 Mar 2020 20:34:22 +0000 (15:34 -0500)
The `m_image_updated` boolean should be reset at the start of the
state checking loop now that we scan the local image meta and check
for forced-promotion of the local image.

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

index 3d5003a0c1b52f025ca3f6b3e48a182b933bde84..2bb495913a54ceba758a0d03f4c3635665abf1be 100644 (file)
@@ -279,6 +279,12 @@ template <typename I>
 void Replayer<I>::load_local_image_meta() {
   dout(10) << dendl;
 
+  {
+    // reset state in case new snapshot is added while we are scanning
+    std::unique_lock locker{m_lock};
+    m_image_updated = false;
+  }
+
   ceph_assert(m_state_builder->local_image_meta != nullptr);
   auto ctx = create_context_callback<
     Replayer<I>, &Replayer<I>::handle_load_local_image_meta>(this);
@@ -461,9 +467,6 @@ void Replayer<I>::scan_remote_mirror_snapshots(
     std::unique_lock<ceph::mutex>* locker) {
   dout(10) << dendl;
 
-  // reset state in case new snapshot is added while we are scanning
-  m_image_updated = false;
-
   bool split_brain = false;
   bool remote_demoted = false;
   auto remote_image_ctx = m_state_builder->remote_image_ctx;