]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: remove image_map next_state if sets to the same state
authorArthur Outhenin-Chalandre <arthur.outhenin-chalandre@cern.ch>
Fri, 6 Aug 2021 13:54:38 +0000 (15:54 +0200)
committerArthur Outhenin-Chalandre <arthur.outhenin-chalandre@cern.ch>
Wed, 12 Jan 2022 09:03:43 +0000 (10:03 +0100)
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 <arthur.outhenin-chalandre@cern.ch>
(cherry picked from commit b664a95889b35d0d3afbd8428e3af4976d7f81eb)

src/tools/rbd_mirror/image_map/Policy.cc

index ccf188742a10705c74c8b4687ef8b74fb9663368..62fbd12dc0bc8df4f83396815932572dc79134c2 100644 (file)
@@ -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;