From dccecc83ab8becc7e3ca41aaad71184912425f02 Mon Sep 17 00:00:00 2001 From: Arthur Outhenin-Chalandre Date: Fri, 6 Aug 2021 15:54:38 +0200 Subject: [PATCH] rbd-mirror: remove image_map next_state if sets to the same state In some cases, set_state is called with DISSOCIATING, then ASSOCIATING and DISSOCIATING again. In this case the state DISSOCIATING is processed to remove the image and then schedule the next action which is associating. To fix this case, this commit removes the next_state if the state is sets to the same state. Signed-off-by: Arthur Outhenin-Chalandre (cherry picked from commit b664a95889b35d0d3afbd8428e3af4976d7f81eb) --- src/tools/rbd_mirror/image_map/Policy.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/rbd_mirror/image_map/Policy.cc b/src/tools/rbd_mirror/image_map/Policy.cc index ccf188742a107..62fbd12dc0bc8 100644 --- a/src/tools/rbd_mirror/image_map/Policy.cc +++ b/src/tools/rbd_mirror/image_map/Policy.cc @@ -380,6 +380,7 @@ bool Policy::can_shuffle_image(const std::string &global_image_id) { bool Policy::set_state(ImageState* image_state, StateTransition::State state, bool ignore_current_state) { if (!ignore_current_state && image_state->state == state) { + image_state->next_state = boost::none; return false; } else if (StateTransition::is_idle(image_state->state)) { image_state->state = state; -- 2.39.5