From e2e1f35febb5eccf337b6123339e975241bf5abf Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Mon, 18 May 2015 00:06:06 +0200 Subject: [PATCH] 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 --- src/erasure-code/ErasureCodePlugin.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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() { -- 2.47.3