From 4e379cd93e76eea59f0babb1de377d068b2e2385 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Fri, 1 Oct 2021 18:29:28 +0000 Subject: [PATCH] mon: don't let users remove the tiebreaker monitor from the map Signed-off-by: Greg Farnum --- src/mon/MonmapMonitor.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mon/MonmapMonitor.cc b/src/mon/MonmapMonitor.cc index c3d42f76c5f..66bce6d0ab7 100644 --- a/src/mon/MonmapMonitor.cc +++ b/src/mon/MonmapMonitor.cc @@ -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. -- 2.47.3