]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MgrMonitor: only drop active if exists
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 18 Apr 2024 19:40:19 +0000 (15:40 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Tue, 25 Feb 2025 16:17:14 +0000 (11:17 -0500)
This avoids an assertion in ::drop_active.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 3fca1187460cdd05c08879b19840d78d787da9b0)

src/mon/MgrMonitor.cc

index 580fd0da5fa9535733a7785ba11ca7673ea990d8..74cfa7113860058f72598bea28dd18ae1bfc43e2 100644 (file)
@@ -1220,12 +1220,15 @@ bool MgrMonitor::prepare_command(MonOpRequestRef op)
         return r;
       }
       if (enable_down) {
-        if (!mon.osdmon()->is_writeable()) {
+        bool has_active = !!pending_map.active_gid;
+        if (has_active && !mon.osdmon()->is_writeable()) {
           mon.osdmon()->wait_for_writeable(op, new C_RetryMessage(this, op));
           return false;
         }
         pending_map.flags |= MgrMap::FLAG_DOWN;
-        plugged |= drop_active();
+        if (has_active) {
+          plugged |= drop_active();
+        }
       } else {
         pending_map.flags &= ~(MgrMap::FLAG_DOWN);
       }