From 1538352ee57ebc190cf3fd900f9a37f5e792137d Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Wed, 1 Jun 2016 11:29:39 +0800 Subject: [PATCH] mon/MDSMonitor: require max_mds to be positive Signed-off-by: xie xingguo --- src/mon/MDSMonitor.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index b06b2ef6b984f..f78df26496f87 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -1806,8 +1806,15 @@ public: if (var == "max_mds") { // NOTE: see also "mds set_max_mds", which can modify the same field. if (interr.length()) { + ss << interr; return -EINVAL; } + + if (n <= 0) { + ss << "You must specify at least one MDS"; + return -EINVAL; + } + if (!fs->mds_map.allows_multimds() && n > fs->mds_map.get_max_mds() && n > 1) { ss << "multi-MDS clusters are not enabled; set 'allow_multimds' to enable"; @@ -2385,7 +2392,7 @@ int MDSMonitor::legacy_filesystem_command( if (prefix == "mds set_max_mds") { // NOTE: deprecated by "fs set max_mds" int64_t maxmds; - if (!cmd_getval(g_ceph_context, cmdmap, "maxmds", maxmds) || maxmds < 0) { + if (!cmd_getval(g_ceph_context, cmdmap, "maxmds", maxmds) || maxmds <= 0) { return -EINVAL; } -- 2.39.5