From: xie xingguo Date: Wed, 28 Jun 2017 03:43:32 +0000 (+0800) Subject: mon/OSDMonitor: fix error handling if we fail to set some pool opts X-Git-Tag: ses5-milestone8~1^2~11^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=820b12f448fa0fbc5657f129b0a67413bbae616e;p=ceph.git mon/OSDMonitor: fix error handling if we fail to set some pool opts 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 --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 09d3d1905723..d9140b92eb12 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -6140,28 +6140,28 @@ int OSDMonitor::prepare_command_pool_set(map &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;