]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
fix the bug if we set pgp_num=-1 using "ceph osd pool set data|metadata|rbd -1"
authorhuangjun <hjwsm1989@gmail.com>
Mon, 28 Oct 2013 04:12:26 +0000 (12:12 +0800)
committerSage Weil <sage@inktank.com>
Mon, 28 Oct 2013 20:29:50 +0000 (13:29 -0700)
   will set the pgp_num to a hunge number.

Signed-off-by: huangjun <hjwsm1989@gmail.com>
(cherry picked from commit bf198e673fd876e34006d3c83f0479454e6295aa)

src/mon/OSDMonitor.cc

index 14a5d70407172b3320ea158da77faae81443938c..9af7b2236674ff9bb7ab70905c19c4c56c5cb115 100644 (file)
@@ -2793,7 +2793,9 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
       ss << "error parsing integer value '" << val << "': " << interr;
       return -EINVAL;
     }
-    if (n > (int)p.get_pg_num()) {
+    if (n <= 0) {
+      ss << "specified pgp_num must > 0, but you set to " << n;
+    } else if (n > (int)p.get_pg_num()) {
       ss << "specified pgp_num " << n << " > pg_num " << p.get_pg_num();
     } else if (!mon->pgmon()->pg_map.creating_pgs.empty()) {
       ss << "still creating pgs, wait";