summaryrefslogtreecommitdiffstats
path: root/src/erasure-code/jerasure
diff options
context:
space:
mode:
authorLoic Dachary <loic-201408@dachary.org>2014-08-21 18:38:52 +0200
committerLoic Dachary <loic-201408@dachary.org>2014-08-28 12:17:15 +0200
commit3c4220e14de50ee74252f90615e050076b0ce442 (patch)
treec65d77cf79ac294eb094940a30b69495cab3f5af /src/erasure-code/jerasure
parenterasure-code: implement ErasureCodePluginRegistry::remove (diff)
downloadceph-3c4220e14de50ee74252f90615e050076b0ce442.tar.xz
ceph-3c4220e14de50ee74252f90615e050076b0ce442.zip
erasure-code: add Ceph version check to plugins
Add the __erasure_code_version function to all plugins, to return the Ceph version against which they have been compiled. When a plugin is loaded, an error is thrown if the version of the plugin does not match the version of the daemon loading it. If the symbol does not exist, which will be true of older plugins, set the version to "an older version" so it never matches. http://tracker.ceph.com/issues/9167 Fixes: #9167 Signed-off-by: Loic Dachary <loic-201408@dachary.org>
Diffstat (limited to 'src/erasure-code/jerasure')
-rw-r--r--src/erasure-code/jerasure/ErasureCodePluginJerasure.cc3
-rw-r--r--src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc3
-rw-r--r--src/erasure-code/jerasure/Makefile.am4
3 files changed, 10 insertions, 0 deletions
diff --git a/src/erasure-code/jerasure/ErasureCodePluginJerasure.cc b/src/erasure-code/jerasure/ErasureCodePluginJerasure.cc
index 8f4f5c6ee46..e5f8b839f68 100644
--- a/src/erasure-code/jerasure/ErasureCodePluginJerasure.cc
+++ b/src/erasure-code/jerasure/ErasureCodePluginJerasure.cc
@@ -15,6 +15,7 @@
*
*/
+#include "ceph_ver.h"
#include "common/debug.h"
#include "erasure-code/ErasureCodePlugin.h"
#include "ErasureCodeJerasure.h"
@@ -71,6 +72,8 @@ extern gf_t *gfp_array[];
extern int gfp_is_composite[];
}
+const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
+
int __erasure_code_init(char *plugin_name, char *directory)
{
ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
diff --git a/src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc b/src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc
index dfb60953880..53c70266a9b 100644
--- a/src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc
+++ b/src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc
@@ -15,6 +15,7 @@
*
*/
+#include "ceph_ver.h"
#include "common/debug.h"
#include "arch/probe.h"
#include "arch/intel.h"
@@ -74,6 +75,8 @@ public:
}
};
+const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
+
int __erasure_code_init(char *plugin_name, char *directory)
{
ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
diff --git a/src/erasure-code/jerasure/Makefile.am b/src/erasure-code/jerasure/Makefile.am
index 914d1eda6cd..86763af9d11 100644
--- a/src/erasure-code/jerasure/Makefile.am
+++ b/src/erasure-code/jerasure/Makefile.am
@@ -33,6 +33,8 @@ jerasure_sources = \
erasure-code/jerasure/ErasureCodePluginJerasure.cc \
erasure-code/jerasure/ErasureCodeJerasure.cc
+erasure-code/jerasure/ErasureCodePluginJerasure.cc: ./ceph_ver.h
+
libec_jerasure_generic_la_SOURCES = ${jerasure_sources}
libec_jerasure_generic_la_CFLAGS = ${AM_CFLAGS} \
-I$(srcdir)/erasure-code/jerasure/gf-complete/include \
@@ -108,4 +110,6 @@ if LINUX
libec_jerasure_la_LDFLAGS += -export-symbols-regex '.*__erasure_code_.*'
endif
+erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc: ./ceph_ver.h
+
erasure_codelib_LTLIBRARIES += libec_jerasure.la