]> git-server-git.apps.pok.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@redhat.com>
Wed, 1 May 2024 13:00:37 +0000 (09:00 -0400)
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 4e9fa7d023267312b91c4d3d735d7d1dccf371eb..5cf73f7711222333bd209813286c2f326b7d371f 100644 (file)
@@ -1206,12 +1206,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);
       }