]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: potential race on image close
authorJason Dillaman <dillaman@redhat.com>
Mon, 15 Feb 2016 17:10:17 +0000 (12:10 -0500)
committerJason Dillaman <dillaman@redhat.com>
Mon, 15 Feb 2016 17:35:22 +0000 (12:35 -0500)
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 <dillaman@redhat.com>
src/librbd/ImageState.cc

index 1bf628eb2b26eeb054943464e789547162255352..b09e4d928293ff4f56a7a0a08e41d6f1e4a6837a 100644 (file)
@@ -237,7 +237,6 @@ void ImageState<I>::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<I>::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();
   }