]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/OSDMonitor: fix error handling if we fail to set some pool opts
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 28 Jun 2017 03:43:32 +0000 (11:43 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 28 Jun 2017 05:33:07 +0000 (13:33 +0800)
Returning a positive error code is generally not the preferred option
and can not be handled properly by caller here.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/mon/OSDMonitor.cc

index 09d3d1905723893c29b612ea63df6639f867b49e..d9140b92eb1226e0c7f99541bfad43fbd2cf8561 100644 (file)
@@ -6140,28 +6140,28 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
       auto cmode = Compressor::get_comp_mode_type(val);
       if (!cmode) {
        ss << "unrecognized compression mode '" << val << "'";
-       return EINVAL;
+       return -EINVAL;
       }
     } else if (var == "compression_algorithm") {
       auto alg = Compressor::get_comp_alg_type(val);
       if (!alg) {
         ss << "unrecognized compression_algorithm '" << val << "'";
-       return EINVAL;
+       return -EINVAL;
       }
     } else if (var == "compression_required_ratio") {
       if (floaterr.length()) {
         ss << "error parsing float value '" << val << "': " << floaterr;
         return -EINVAL;
       }
-      if (f < 0 || f>1) {
+      if (f < 0 || f > 1) {
         ss << "compression_required_ratio is out of range (0-1): '" << val << "'";
-       return EINVAL;
+       return -EINVAL;
       }
     } else if (var == "csum_type") {
       auto t = val != "unset" ? Checksummer::get_csum_string_type(val) : 0;
       if (t < 0 ) {
         ss << "unrecognized csum_type '" << val << "'";
-       return EINVAL;
+       return -EINVAL;
       }
       //preserve csum_type numeric value
       n = t;