From: Yan Jun Date: Tue, 3 Sep 2019 14:16:04 +0000 (+0800) Subject: osd: add sanity check for invalid m/w of liber8tion X-Git-Tag: v15.1.0~1639^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=1032b981da6118d95220d3257e7045793d51371c;p=ceph-ci.git osd: add sanity check for invalid m/w of liber8tion Signed-off-by: Yan Jun --- diff --git a/src/erasure-code/jerasure/ErasureCodeJerasure.cc b/src/erasure-code/jerasure/ErasureCodeJerasure.cc index 5a732c2e634..3a780de811c 100644 --- a/src/erasure-code/jerasure/ErasureCodeJerasure.cc +++ b/src/erasure-code/jerasure/ErasureCodeJerasure.cc @@ -191,8 +191,6 @@ int ErasureCodeJerasureReedSolomonVandermonde::parse(ErasureCodeProfile &profile if (w != 8 && w != 16 && w != 32) { *ss << "ReedSolomonVandermonde: w=" << w << " must be one of {8, 16, 32} : revert to " << DEFAULT_W << std::endl; - profile["w"] = "8"; - err |= to_int("w", profile, &w, DEFAULT_W, ss); err = -EINVAL; } err |= to_bool("jerasure-per-chunk-alignment", profile, @@ -247,8 +245,6 @@ int ErasureCodeJerasureReedSolomonRAID6::parse(ErasureCodeProfile &profile, if (w != 8 && w != 16 && w != 32) { *ss << "ReedSolomonRAID6: w=" << w << " must be one of {8, 16, 32} : revert to 8 " << std::endl; - profile["w"] = "8"; - err |= to_int("w", profile, &w, DEFAULT_W, ss); err = -EINVAL; } return err; @@ -488,10 +484,16 @@ int ErasureCodeJerasureLiber8tion::parse(ErasureCodeProfile &profile, ostream *ss) { int err = ErasureCodeJerasure::parse(profile, ss); - profile.erase("m"); - err |= to_int("m", profile, &m, DEFAULT_M, ss); - profile.erase("w"); - err |= to_int("w", profile, &w, DEFAULT_W, ss); + if (m != stoi(DEFAULT_M)) { + *ss << "liber8tion: m=" << m << " must be " << DEFAULT_M + << " for liber8tion: revert to " << DEFAULT_M << std::endl; + err = -EINVAL; + } + if (w != stoi(DEFAULT_W)) { + *ss << "liber8tion: w=" << w << " must be " << DEFAULT_W + << " for liber8tion: revert to " << DEFAULT_W << std::endl; + err = -EINVAL; + } err |= to_int("packetsize", profile, &packetsize, DEFAULT_PACKETSIZE, ss); bool error = false;