]> git.apps.os.sepia.ceph.com Git - ceph-ci.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@redhat.com>
Mon, 29 Apr 2024 16:22:26 +0000 (12:22 -0400)
This avoids an assertion in ::drop_active.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mon/MgrMonitor.cc

index 034f584a95d565d936793ed02161cd51c51f9ad0..a7bd42c861170da8b32b4b127aff6e9fe6447a27 100644 (file)
@@ -1188,12 +1188,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);
       }