]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: enforce reweight be between 0..1
authorSage Weil <sage@inktank.com>
Mon, 4 Feb 2013 17:14:39 +0000 (09:14 -0800)
committerSage Weil <sage@inktank.com>
Mon, 4 Feb 2013 17:14:39 +0000 (09:14 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Luis <joao.luis@inktank.com>
src/mon/OSDMonitor.cc

index 3d11cfffc0fc3b32c37f82a205c0648abd487152..507eed74c421b577d76bdd1696007228da6c219f 100644 (file)
@@ -2527,6 +2527,11 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
        err = -EINVAL;
       } else {
        float w = strtof(m->cmd[3].c_str(), 0);
+       if (w > 1.0 || w < 0) {
+         ss << "weight must be in the range [0..1]";
+         err = -EINVAL;
+         goto out;
+       }
        long ww = (int)((float)CEPH_OSD_IN*w);
        if (ww < 0L) {
          ss << "weight must be > 0";