]> 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>
Mon, 25 Feb 2019 18:31:43 +0000 (13:31 -0500)
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>
src/librbd/ManagedLock.cc

index 6118cd09cfa6eed920fb3c63d22ccad25543d721..15d2016f26a3216c0af880956f23853d970ed77d 100644 (file)
@@ -454,9 +454,17 @@ template <typename I>
 bool ManagedLock<I>::is_state_shutdown() const {
   ceph_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>