]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: do not propagate image map instance updates when shutting down
authorJason Dillaman <dillaman@redhat.com>
Mon, 14 May 2018 14:34:28 +0000 (10:34 -0400)
committerJason Dillaman <dillaman@redhat.com>
Sat, 19 May 2018 12:17:00 +0000 (08:17 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 4525b7a597ccfa6e966243e24bd9e9662c994a41)

src/tools/rbd_mirror/PoolReplayer.cc

index 0950546aa2b7b7a7096a907059b4f2318243b61b..ea28a27c70c767e5b2942ef61f951a220ed50bf8 100644 (file)
@@ -1040,7 +1040,12 @@ void PoolReplayer<I>::handle_remove_image(const std::string &mirror_uuid,
 template <typename I>
 void PoolReplayer<I>::handle_instances_added(const InstanceIds &instance_ids) {
   dout(5) << "instance_ids=" << instance_ids << dendl;
+  Mutex::Locker locker(m_lock);
+  if (!m_leader_watcher->is_leader()) {
+    return;
+  }
 
+  assert(m_image_map);
   m_image_map->update_instances_added(instance_ids);
 }
 
@@ -1048,7 +1053,12 @@ template <typename I>
 void PoolReplayer<I>::handle_instances_removed(
     const InstanceIds &instance_ids) {
   dout(5) << "instance_ids=" << instance_ids << dendl;
+  Mutex::Locker locker(m_lock);
+  if (!m_leader_watcher->is_leader()) {
+    return;
+  }
 
+  assert(m_image_map);
   m_image_map->update_instances_removed(instance_ids);
 }