From: Jason Dillaman Date: Mon, 15 Feb 2016 17:10:17 +0000 (-0500) Subject: librbd: potential race on image close X-Git-Tag: v10.1.0~377^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7ae774b8e04e5d64e141e5b4ff9feaddd96d29d6;p=ceph.git librbd: potential race on image close If multiple states are pending, it's possible for an image to be closed while the state lock is unlocked during the callback. Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/ImageState.cc b/src/librbd/ImageState.cc index 1bf628eb2b26..b09e4d928293 100644 --- a/src/librbd/ImageState.cc +++ b/src/librbd/ImageState.cc @@ -237,7 +237,6 @@ void ImageState::complete_action(State next_state, int r) { ActionContexts action_contexts(std::move(m_actions_contexts.front())); m_actions_contexts.pop_front(); - m_state = next_state; m_lock.Unlock(); for (auto ctx : action_contexts.second) { @@ -245,6 +244,7 @@ void ImageState::complete_action(State next_state, int r) { } m_lock.Lock(); + m_state = next_state; if (!is_transition_state() && !m_actions_contexts.empty()) { execute_next_action(); }