]> git-server-git.apps.pok.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" 776/head
authorhuangjun <hjwsm1989@gmail.com>
Mon, 28 Oct 2013 04:12:26 +0000 (12:12 +0800)
committerhuangjun <hjwsm1989@gmail.com>
Mon, 28 Oct 2013 04:12:26 +0000 (12:12 +0800)
   will set the pgp_num to a hunge number.

Signed-off-by: huangjun <hjwsm1989@gmail.com>
src/mon/OSDMonitor.cc

index 83e858470453647e5d4b763c33a7a1ac9ebef0b4..1378e93770e048d99763954af13301db4b96f525 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";