]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: add missing shutdown states to managed lock helper
authorJason Dillaman <dillaman@redhat.com>
Tue, 19 Feb 2019 21:06:48 +0000 (16:06 -0500)
committerJason Dillaman <dillaman@redhat.com>
Thu, 16 May 2019 15:31:40 +0000 (11:31 -0400)
The PRE_SHUTTING_DOWN and SHUTTING_DOWN states were missed
in the 'is_state_shutdown' helper method. This resulted in
rbd-mirror potentially entering an infinite loop during
shutdown.

http://tracker.ceph.com/issues/38387
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 82af5710ad49dd6e24c2736a9865e1a41add89a2)

src/librbd/ManagedLock.cc

index 38fd3aa9d79b81d181db110a3067324b9455c814..3ee870b39e685810ce4554b3d55a98a29bf18dac 100644 (file)
@@ -453,9 +453,17 @@ template <typename I>
 bool ManagedLock<I>::is_state_shutdown() const {
   assert(m_lock.is_locked());
 
-  return ((m_state == STATE_SHUTDOWN) ||
-          (!m_actions_contexts.empty() &&
-           m_actions_contexts.back().first == ACTION_SHUT_DOWN));
+  switch (m_state) {
+  case STATE_PRE_SHUTTING_DOWN:
+  case STATE_SHUTTING_DOWN:
+  case STATE_SHUTDOWN:
+    return true;
+  default:
+    break;
+  }
+
+  return (!m_actions_contexts.empty() &&
+          m_actions_contexts.back().first == ACTION_SHUT_DOWN);
 }
 
 template <typename I>