]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: reject over-large values of max_mds 5397/head
authorJohn Spray <john.spray@redhat.com>
Wed, 29 Jul 2015 09:05:43 +0000 (10:05 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 30 Jul 2015 06:12:50 +0000 (07:12 +0100)
Fixes: #12222
Signed-off-by: John Spray <john.spray@redhat.com>
qa/workunits/cephtool/test.sh
src/mon/MDSMonitor.cc

index 854a0b4695529b4f8e6113a12bc16721e1514f71..79ce12c3c51f3c75bf7b99fb7b0a17c9eabf264f 100755 (executable)
@@ -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
index 3e39d7b17a47770dcef0d3b3f4be4cac395a4714..9e930b392d44df13d18bfdfd54d0703d034e9ad4 100644 (file)
@@ -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)) {