From: John Spray Date: Wed, 29 Jul 2015 09:05:43 +0000 (+0100) Subject: mon: reject over-large values of max_mds X-Git-Tag: v9.0.3~9^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cb51b17043131a1d13585df3452783f2ab2c58b8;p=ceph.git mon: reject over-large values of max_mds Fixes: #12222 Signed-off-by: John Spray --- diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 854a0b46955..79ce12c3c51 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -732,7 +732,11 @@ function test_mon_mds() ceph osd pool delete data3 data3 --yes-i-really-really-mean-it ceph mds set_max_mds 4 ceph mds set_max_mds 3 + ceph mds set_max_mds 256 + expect_false ceph mds set_max_mds 257 ceph mds set max_mds 4 + ceph mds set max_mds 256 + expect_false ceph mds set max_mds 257 expect_false ceph mds set max_mds asdf expect_false ceph mds set inline_data true ceph mds set inline_data true --yes-i-really-mean-it diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 3e39d7b17a4..9e930b392d4 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -1458,6 +1458,10 @@ int MDSMonitor::filesystem_command( if (!cmd_getval(g_ceph_context, cmdmap, "maxmds", maxmds) || maxmds < 0) { return -EINVAL; } + if (maxmds > MAX_MDS) { + ss << "may not have more than " << MAX_MDS << " MDS ranks"; + return -EINVAL; + } pending_mdsmap.max_mds = maxmds; r = 0; ss << "max_mds = " << pending_mdsmap.max_mds; @@ -1480,6 +1484,10 @@ int MDSMonitor::filesystem_command( if (interr.length()) { return -EINVAL; } + if (n > MAX_MDS) { + ss << "may not have more than " << MAX_MDS << " MDS ranks"; + return -EINVAL; + } pending_mdsmap.max_mds = n; } else if (var == "inline_data") { if (val == "true" || val == "yes" || (!interr.length() && n == 1)) {