]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: don't let users remove the tiebreaker monitor from the map
authorGreg Farnum <gfarnum@redhat.com>
Fri, 1 Oct 2021 18:29:28 +0000 (18:29 +0000)
committerGreg Farnum <gfarnum@redhat.com>
Tue, 5 Oct 2021 00:01:02 +0000 (00:01 +0000)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/mon/MonmapMonitor.cc

index c3d42f76c5fb71d21014d42503dcb3bb7cd61752..66bce6d0ab77ed0d14d6cfa328dde305b481d079 100644 (file)
@@ -714,6 +714,12 @@ bool MonmapMonitor::prepare_command(MonOpRequestRef op)
       goto reply;
     }
 
+    if (pending_map.stretch_mode_enabled &&
+       name == pending_map.tiebreaker_mon) {
+      err = -EINVAL;
+      ss << "you cannot remove stretch mode's tiebreaker monitor";
+      goto reply;
+    }
     /* At the time of writing, there is no risk of races when multiple clients
      * attempt to use the same name. The reason is simple but may not be
      * obvious.