diff options
author | Loic Dachary <ldachary@redhat.com> | 2015-05-18 00:06:06 +0200 |
---|---|---|
committer | Loic Dachary <ldachary@redhat.com> | 2015-06-01 21:52:14 +0200 |
commit | e2e1f35febb5eccf337b6123339e975241bf5abf (patch) | |
tree | 3ce43d8f7b42cb707539b9f28d9847e087af90e4 /src/erasure-code/ErasureCodePlugin.cc | |
parent | mon: normalize erasure-code profile for storage and comparison (diff) | |
download | ceph-e2e1f35febb5eccf337b6123339e975241bf5abf.tar.xz ceph-e2e1f35febb5eccf337b6123339e975241bf5abf.zip |
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 <ldachary@redhat.com>
Diffstat (limited to 'src/erasure-code/ErasureCodePlugin.cc')
-rw-r--r-- | src/erasure-code/ErasureCodePlugin.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/erasure-code/ErasureCodePlugin.cc b/src/erasure-code/ErasureCodePlugin.cc index f8f9eec6a1e..efc4cddeb3c 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() { |