]> git.apps.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 13:28:19 +0000 (09:28 -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 c3cda70204e73d36da099c7aa88559a0e910007b..4b15af7f1bac5800659ad40f17748c6d61ed401e 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>