From: xie xingguo Date: Wed, 1 Jun 2016 03:29:39 +0000 (+0800) Subject: mon/MDSMonitor: require max_mds to be positive X-Git-Tag: v11.0.0~336^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1538352ee57ebc190cf3fd900f9a37f5e792137d;p=ceph.git mon/MDSMonitor: require max_mds to be positive Signed-off-by: xie xingguo --- diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index b06b2ef6b984..f78df26496f8 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; }