]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd-mirror: avoid sending duplicate re-acquire messages upon leader startup
authorJason Dillaman <dillaman@redhat.com>
Wed, 9 May 2018 14:25:22 +0000 (10:25 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 15 May 2018 20:29:36 +0000 (16:29 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_mirror/image_map/Policy.cc

index a60c8fc04208ac3a4461d99651dcd06102b4c04e..03c5705b656a44196b90d6fce73738fe1e9671f9 100644 (file)
@@ -90,6 +90,11 @@ bool Policy::add_image(const std::string &global_image_id) {
   auto image_state_result = m_image_states.emplace(global_image_id,
                                                    ImageState{});
   auto& image_state = image_state_result.first->second;
+  if (image_state.state == StateTransition::STATE_INITIALIZING) {
+    // avoid duplicate acquire notifications upon leader startup
+    return false;
+  }
+
   return set_state(&image_state, StateTransition::STATE_ASSOCIATING, false);
 }