]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code: verify the profile content matches get_profile() 4712/head
authorLoic Dachary <ldachary@redhat.com>
Sun, 17 May 2015 22:06:06 +0000 (00:06 +0200)
committerLoic Dachary <ldachary@redhat.com>
Mon, 1 Jun 2015 19:52:14 +0000 (21:52 +0200)
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>
src/erasure-code/ErasureCodePlugin.cc

index f8f9eec6a1ef573e22d77aa2b2bdf6d7babdd4dc..efc4cddeb3c03ffcd6661b79f5d0d6dc1bfa0c01 100644 (file)
@@ -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() {