From: Loic Dachary Date: Sun, 17 May 2015 22:06:06 +0000 (+0200) Subject: erasure-code: verify the profile content matches get_profile() X-Git-Tag: v9.0.2~67^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F4712%2Fhead;p=ceph.git erasure-code: verify the profile content matches get_profile() The profile stored by the plugin may be different from the one set by the user: it includes defaults. When the plugin is initialized, the profile is modified to include the default values. Verify that the modified profile matches what the get_profile() method returns, to guard against inconsistencies from the erasure code plugin implementation. http://tracker.ceph.com/issues/11663 Fixes: #11663 Signed-off-by: Loic Dachary --- diff --git a/src/erasure-code/ErasureCodePlugin.cc b/src/erasure-code/ErasureCodePlugin.cc index f8f9eec6a1ef..efc4cddeb3c0 100644 --- a/src/erasure-code/ErasureCodePlugin.cc +++ b/src/erasure-code/ErasureCodePlugin.cc @@ -102,7 +102,15 @@ int ErasureCodePluginRegistry::factory(const std::string &plugin_name, } } - return plugin->factory(profile, erasure_code, ss); + int r = plugin->factory(profile, erasure_code, ss); + if (r) + return r; + if (profile != (*erasure_code)->get_profile()) { + *ss << __func__ << " profile " << profile << " != get_profile() " + << (*erasure_code)->get_profile() << std::endl; + return -EINVAL; + } + return 0; } static const char *an_older_version() {