multipath-tools: add linker version scripts
v2 cover multipath-tools: add linker version scripts
From: Martin Wilck <[email protected]>
Hi Christophe, hi Ben,
Patch 1-5 are small fixes, the first two resent from an earlier submission. Patch 6ff. add version scripts for the linker to libmultipath, libmpathpersist, and libmpathcmd.
(new in v2: versions start at 1.0.0 for all 3 libraries).
Is it useful to do this for libmultipath? We have always said that this is not a public, stable ABI. However, I still believe it has merits. First of all, it's a description of the ABI we use. It turns out that it cuts the size of the exported symbol list of libmultipath roughly in half, which is better than I'd expected. It leads to ld.so-time failure rather than weird crashes in the unlikely case that non-matching binaries are used together. It allows packaging scripts to check compatibility of binaries and libraries without resorting to version and release. It will help us stabilize the ABI, albeit only in the long run. Finally, it's a step towards modernizing our code base in general.
To avoid misunderstanding, my intention is not to provide a stable or even backward-compatible ABI in libmultipath.so.0. We're still allowed to make changes to globally visible data structures like "struct config", and to remove symbols from the ABI, like no serious shared library would do. We just need to bump the ABI version when we do so.
Changes v1->v2:
08/12: "libmultipath: create separate .so for unit tests"
fix test_clean rule (Ben)
9/12-11/12: Changed library versions from 0.8.4 to 1.0.0 as discussed with Ben,
kept Reviewed-by: trailer
12/12 "libmpathpersist: initialize mpp->hwe in get_mpvec()"
Fix for the issue mentioned by Ben in his review for 02/12 "libmultipath: copy mpp->hwe from pp->hwe"
Regards
Martin
Martin Wilck (12):
libmultipath: find_mpe(): don't match with empty WWID
libmultipath: copy mpp->hwe from pp->hwe
libmultipath: dm_map_present_by_uuid(): fix dm_task_create() call libdmmp tests: fix compilation
libmultipath: prio: constify some function parameters
libmultipath: checkers/prio: allow non-lazy .so loading multipath-tools Makefiles: separate rules for .so and man pages
libmultipath: create separate .so for unit tests
libmultipath: add linker version script
libmpathpersist: add linker version script
libmpathcmd: add linker version script
libmpathpersist: initialize mpp->hwe in get_mpvec()
libdmmp/test/libdmmp_speed_test.c | 2 +- libdmmp/test/libdmmp_test.c | 2 +- libmpathcmd/Makefile | 14 +- libmpathcmd/libmpathcmd.version | 25 +++ libmpathpersist/Makefile | 16 +- libmpathpersist/libmpathpersist.version | 32 +++ libmpathpersist/mpath_persist.c | 6 +- libmultipath/Makefile | 22 ++- libmultipath/checkers.c | 17 ++ libmultipath/config.c | 2 +- libmultipath/configure.c | 7 + libmultipath/devmapper.c | 2 +- libmultipath/libmultipath.version | 248 ++++++++++++++++++++++++ libmultipath/prio.c | 26 ++- libmultipath/prio.h | 4 +- libmultipath/propsel.c | 4 +- libmultipath/structs.c | 15 ++ libmultipath/structs.h | 1 + libmultipath/structs_vec.c | 54 +++--- multipathd/main.c | 10 - tests/Makefile | 10 +- 21 files changed, 445 insertions(+), 74 deletions(-) create mode 100644 libmpathcmd/libmpathcmd.version create mode 100644 libmpathpersist/libmpathpersist.version create mode 100644 libmultipath/libmultipath.version
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
PATCH v2 1/12 libmultipath: find_mpe(): don't match with empty WWID
From: Martin Wilck <[email protected]>
--- libmultipath/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/config.c +1 -1
@@ -147,7 +147,7 @@ struct mpentry *find_mpe(vector mptable, char *wwid)int i;struct mpentry * mpe; -if (!wwid) +if (!wwid || !*wwid)return NULL ;vector_foreach_slot (mptable, mpe, i)
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
PATCH v2 2/12 libmultipath: copy mpp->hwe from pp->hwe
In reply to [email protected]From: Martin Wilck <[email protected]>
Since f0462f0 ("libmultipath: use vector for for pp->hwe and mp->hwe"), we've been trying to fix issues caused by paths getting freed and mpp->hwe dangling. This approach couldn't work because we need mpp->hwe to persist, even if all paths are removed from the map. Before f0462f0, a simple assignment worked, because the lifetime of the hwe wasn't bound to the path. But now, we need to copy the vector. It turns out that we need to set mpp->hwe only in two places, add_map_with_path() and setup_map(), and that the code is simplified overall.
Even now, it can happen that a map is added with add_map_without_paths(), and has no paths. In that case, calling do_set_from_hwe() with a NULL pointer is not a bug, so remove the message.
--- libmultipath/configure.c | 7 +++++ libmultipath/propsel.c | 4 +-- libmultipath/structs.c | 15 +++++++++++ libmultipath/structs.h | 1 + libmultipath/structs_vec.c | 54 ++++++++++++++++---------------------- multipathd/main.c | 10 ------- 6 files changed, 46 insertions(+), 45 deletions(-)
libmultipath/configure.c +7 -0
@@ -311,6 +311,13 @@ int setup_map(struct multipath *mpp, char *params, int params_size,if (mpp->disable_queueing &&VECTOR_SIZE (mpp->paths) !=0 ) mpp->disable_queueing =0 ; +/* +* If this map was created with add_map_without_path(), +* mpp->hwe might not be set yet. +*/ +if (!mpp->hwe) +extract_hwe_from_path (mpp); +/* * properties selectors *
libmultipath/propsel.c +1 -3
@@ -65,9 +65,7 @@ do { \ __do_set_from_vec(struct hwentry, var, (src)->hwe, dest)#define do_set_from_hwe (var, src, dest, msg) \ - if (!src->hwe) { \ - condlog(0, "BUG: do_set_from_hwe called with hwe == NULL"); \ - } else if (__do_set_from_hwe(var, src, dest)) { \ + if (src->hwe && __do_set_from_hwe(var, src, dest)) { \ origin = msg; \ goto out; \ }
libmultipath/structs.c +15 -0
@@ -234,6 +234,17 @@ alloc_multipath (void)return mpp; } +void *set_mpp_hwe (struct multipath *mpp,const struct path *pp) +{ +if (!mpp || !pp || !pp->hwe) +return NULL ; +if (mpp->hwe) +return mpp->hwe; + mpp->hwe =vector_convert (NULL , pp->hwe, + struct hwentry, identity); +return mpp->hwe; +} +void free_multipath_attributes (struct multipath *mpp) {if (!mpp)
@@ -290,6 +301,10 @@ free_multipath (struct multipath * mpp, enum free_path_mode free_paths)free_pathvec (mpp->paths, free_paths);free_pgvec (mpp->pg, free_paths); +if (mpp->hwe) { +vector_free (mpp->hwe); + mpp->hwe =NULL ; + }FREE_PTR (mpp->mpcontext);FREE (mpp); }
libmultipath/structs.h +1 -0
@@ -422,6 +422,7 @@ struct host_group {struct path *alloc_path (void );struct pathgroup *alloc_pathgroup (void );struct multipath *alloc_multipath (void ); +void *set_mpp_hwe (struct multipath *mpp,const struct path *pp);void uninitialize_path (struct path *pp);void free_path (struct path *);void free_pathvec (vector vec,enum free_path_mode free_paths);
libmultipath/structs_vec.c +22 -32
109 lines not on this page · raw message
multipathd/main.c +0 -10
@@ -1153,13 +1153,6 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map)if (i !=-1 )vector_del_slot (mpp->paths, i); -/* -* Make sure mpp->hwe doesn't point to freed memory -* We call extract_hwe_from_path() below to restore mpp->hwe -*/ -if (mpp->hwe == pp->hwe) - mpp->hwe =NULL ; -/* * remove the map IF removing the last path */
@@ -1191,9 +1184,6 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map)*/ } -if (mpp->hwe ==NULL ) -extract_hwe_from_path (mpp); -if (setup_map (mpp, params,PARAMS_SIZE , vecs)) {condlog (0 ,"%s: failed to setup map for" " removal of path %s" , mpp->alias, pp->dev);
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
PATCH v2 3/12 libmultipath: dm_map_present_by_uuid(): fix dm_task_create() call
In reply to [email protected]From: Martin Wilck <[email protected]>
libmultipath shouldn't call dm_task_create() directly any more.
--- libmultipath/devmapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/devmapper.c +1 -1
@@ -834,7 +834,7 @@ dm_map_present_by_uuid(const char *uuid)if (safe_sprintf (prefixed_uuid,UUID_PREFIX "%s" , uuid)) goto out; -if (!(dmt =dm_task_create (DM_DEVICE_INFO ))) +if (!(dmt =libmp_dm_task_create (DM_DEVICE_INFO ))) goto out;dm_task_no_open_count (dmt);
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
PATCH v2 4/12 libdmmp tests: fix compilation
In reply to [email protected]From: Martin Wilck <[email protected]>
These tests don't compile with -Werror=unused-parameter. Fix it.
--- libdmmp/test/libdmmp_speed_test.c | 2 +- libdmmp/test/libdmmp_test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
libdmmp/test/libdmmp_speed_test.c +1 -1
@@ -27,7 +27,7 @@#include <libdmmp/libdmmp.h> -int main (int argc,char *argv[]) +int main (void ) {struct dmmp_context *ctx =NULL ;struct dmmp_mpath **dmmp_mps =NULL ;
libdmmp/test/libdmmp_test.c +1 -1
@@ -102,7 +102,7 @@ out:return rc; } -int main (int argc,char *argv[]) +int main (void ) {struct dmmp_context *ctx =NULL ;struct dmmp_mpath **dmmp_mps =NULL ;
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
PATCH v2 5/12 libmultipath: prio: constify some function parameters
In reply to [email protected]From: Martin Wilck <[email protected]>
--- libmultipath/prio.c | 4 ++-- libmultipath/prio.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
libmultipath/prio.c +2 -2
@@ -18,7 +18,7 @@ unsigned int get_prio_timeout(unsigned int timeout_ms,return default_timeout; } -int init_prio (char *multipath_dir) +int init_prio (const char *multipath_dir) {if (!add_prio (multipath_dir,DEFAULT_PRIO ))return 1 ;
@@ -87,7 +87,7 @@ int prio_set_args (struct prio * p, const char * args)return snprintf (p->args,PRIO_ARGS_LEN ,"%s" , args); } -struct prio *add_prio (char *multipath_dir,char * name) +struct prio *add_prio (const char *multipath_dir,const char * name) {char libname[LIB_PRIO_NAMELEN ];struct stat stbuf;
libmultipath/prio.h +2 -2
@@ -55,9 +55,9 @@ struct prio {unsigned int get_prio_timeout (unsigned int checker_timeout,unsigned int default_timeout); -int init_prio (char *); +int init_prio (const char *);void cleanup_prio (void ); -struct prio *add_prio (char *,char *); +struct prio *add_prio (const char *,const char *);int prio_getprio (struct prio *,struct path *,unsigned int );void prio_get (char *,struct prio *,char *,char *);void prio_put (struct prio *);
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
PATCH v2 6/12 libmultipath: checkers/prio: allow non-lazy .so loading
In reply to [email protected]From: Martin Wilck <[email protected]>
If compiled with -DLOAD_ALL_SHARED_LIBS, all known prioritizers and checkers will be loaded immediately on startup. This is useful for determining symbol usage (start executables with LD_BIND_NOW=1).
--- libmultipath/checkers.c | 17 +++++++++++++++++ libmultipath/prio.c | 22 ++++++++++++++++++++++ 2 files changed, 39 insertions(+)
libmultipath/checkers.c +17 -0
@@ -7,6 +7,7 @@#include "debug.h" #include "checkers.h" #include "vector.h" +#include "util.h" struct checker_class {struct list_head node;
@@ -375,7 +376,23 @@ void checker_get(const char *multipath_dir, struct checker *dst,int init_checkers (const char *multipath_dir) { +#ifdef LOAD_ALL_SHARED_LIBS +static const char *const all_checkers[] = { +DIRECTIO , +TUR , +HP_SW , +RDAC , +EMC_CLARIION , +READSECTOR0 , +CCISS_TUR , + }; +unsigned int i; + +for (i =0 ; i <ARRAY_SIZE (all_checkers); i++) +add_checker_class (multipath_dir, all_checkers[i]); +#else if (!add_checker_class (multipath_dir,DEFAULT_CHECKER ))return 1 ; +#endif return 0 ; }
libmultipath/prio.c +22 -0
@@ -20,8 +20,30 @@ unsigned int get_prio_timeout(unsigned int timeout_ms,int init_prio (const char *multipath_dir) { +#ifdef LOAD_ALL_SHARED_LIBS +static const char *const all_prios[] = { +PRIO_ALUA , +PRIO_CONST , +PRIO_DATACORE , +PRIO_EMC , +PRIO_HDS , +PRIO_HP_SW , +PRIO_ONTAP , +PRIO_RANDOM , +PRIO_RDAC , +PRIO_WEIGHTED_PATH , +PRIO_SYSFS , +PRIO_PATH_LATENCY , +PRIO_ANA , + }; +unsigned int i; + +for (i =0 ; i <ARRAY_SIZE (all_prios); i++) +add_prio (multipath_dir, all_prios[i]); +#else if (!add_prio (multipath_dir,DEFAULT_PRIO ))return 1 ; +#endif return 0 ; }
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
PATCH v2 7/12 multipath-tools Makefiles: separate rules for .so and man pages
In reply to [email protected]From: Martin Wilck <[email protected]>
Rely more on "make" functionality than on sequential command execution.
--- libmpathcmd/Makefile | 8 +++++--- libmpathpersist/Makefile | 10 +++++++--- libmultipath/Makefile | 8 +++++--- 3 files changed, 17 insertions(+), 9 deletions(-)
libmpathcmd/Makefile +5 -3
@@ -8,13 +8,15 @@ CFLAGS += $(LIB_CFLAGS) OBJS = mpath_cmd.o -all: $(LIBS) +all: $(DEVLIB) $(LIBS): $(OBJS) $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) - $(LN) $@ $(DEVLIB) -install: $(LIBS) +$(DEVLIB): $(LIBS) + $(LN) $(LIBS) $@ + +install: all $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir) $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS) $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
libmpathpersist/Makefile +7 -3
@@ -11,15 +11,19 @@ LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath \ OBJS = mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o -all: $(LIBS) +all: $(DEVLIB) man $(LIBS): $(OBJS) $(CC) $(LDFLAGS) $(SHARED_FLAGS) $(LIBDEPS) -Wl,-soname=$@ -o $@ $(OBJS) - $(LN) $(LIBS) $(DEVLIB) + +$(DEVLIB): $(LIBS) + $(LN) $(LIBS) $@ + +man: $(GZIP) mpath_persistent_reserve_in.3 > mpath_persistent_reserve_in.3.gz $(GZIP) mpath_persistent_reserve_out.3 > mpath_persistent_reserve_out.3.gz -install: $(LIBS) +install: all $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir) $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS) $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
libmultipath/Makefile +5 -3
@@ -50,7 +50,7 @@ OBJS = memory.o parser.o vector.o devmapper.o callout.o \ io_err_stat.o dm-generic.o generic.o foreign.o nvme-lib.o \ libsg.o valid.o -all: $(LIBS) +all: $(DEVLIB) nvme-lib.o: nvme-lib.c nvme-ioctl.c nvme-ioctl.h $(CC) $(CFLAGS) -Wno-unused-function -c -o $@ $<
@@ -70,9 +70,11 @@ nvme-ioctl.h: nvme/nvme-ioctl.h $(LIBS): $(OBJS) $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) - $(LN) $@ $(DEVLIB) -install: +$(DEVLIB): $(LIBS) + $(LN) $(LIBS) $@ + +install: all $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir) $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS) $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir)
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
PATCH v2 8/12 libmultipath: create separate .so for unit tests
In reply to [email protected]From: Martin Wilck <[email protected]>
The unit tests use a lot of internal symbols that we don't want to add to the ABI if we don't have to. As long as we don't have to make incompatible changes to functions, we can work around that by simply using a non-versioned library for the unit tests. Therefore we add a seperate rule here. Do this before actually adding a version script, to avoid breakage during bisection.
--- libmultipath/Makefile | 7 +++++++ tests/Makefile | 10 ++++++---- 2 files changed, 13 insertions(+), 4 deletions(-)
libmultipath/Makefile +7 -0
@@ -74,6 +74,13 @@ $(LIBS): $(OBJS) $(DEVLIB): $(LIBS) $(LN) $(LIBS) $@ +../tests/$(LIBS): $(OBJS) $(VERSION_SCRIPT) + $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=`basename $@` \ + -o $@ $(OBJS) $(LIBDEPS) + $(LN) $@ ${@:.so.0=.so} + +test-lib: ../tests/$(LIBS) + install: all $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir) $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
tests/Makefile +6 -4
@@ -10,7 +10,7 @@ W_MISSING_INITIALIZERS := $(call TEST_MISSING_INITIALIZERS) CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathcmddir) \ -Wno-unused-parameter $(W_MISSING_INITIALIZERS) -LIBDEPS += -L$(multipathdir) -L$(mpathcmddir) -lmultipath -lmpathcmd -lcmocka +LIBDEPS += -L. -L$(mpathcmddir) -lmultipath -lmpathcmd -lcmocka TESTS := uevent parser util dmevents hwtable blacklist unaligned vpd pgpolicy \ alias directio valid devt
@@ -67,7 +67,7 @@ lib/libchecktur.so: %.out: %-test lib/libchecktur.so @echo == running $< == - @LD_LIBRARY_PATH=$(multipathdir):$(mpathcmddir) ./$< >$@ + @LD_LIBRARY_PATH=.:$(mpathcmddir) ./$< >$@ %.vgr: %-test lib/libchecktur.so @echo == running valgrind for $< ==
@@ -77,7 +77,7 @@ lib/libchecktur.so: OBJS = $(TESTS:%=%.o) test-lib.o test_clean: - $(RM) $(TESTS:%=%.out) $(TESTS:%=%.vgr) + $(RM) $(TESTS:%=%.out) $(TESTS:%=%.vgr) *.so* valgrind_clean: $(RM) $(TESTS:%=%.vgr)
@@ -97,12 +97,14 @@ dep_clean: @sed -n 's/^.*__wrap_\([a-zA-Z0-9_]*\).*$$/-Wl,--wrap=\1/p' $< | \ sort -u | tr '\n' ' ' >$@ +libmultipath.so.0: + $(MAKE) -C $(multipathdir) test-lib # COLON will get expanded during second expansion below COLON:=: .SECONDEXPANSION: %-test: %.o %.o.wrap $$($$@_OBJDEPS) $$($$@_TESTDEPS) $$($$@_TESTDEPS$$(COLON).o=.o.wrap) \ - $(multipathdir)/libmultipath.so Makefile + libmultipath.so.0 Makefile $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $< $($@_TESTDEPS) $($@_OBJDEPS) \ $(LIBDEPS) $($@_LIBDEPS) \ $(shell cat $<.wrap) $(foreach dep,$($@_TESTDEPS),$(shell cat $(dep).wrap))
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] [PATCH v2 08/12] libmultipath: create separate .so for unit tests
Quoted 9 lines · On Fri, Oct 16, 2020 at 12:42:35PM +0200, [email protected] wrote:
From: Martin Wilck <[email protected]>
The unit tests use a lot of internal symbols that we don't want to add to the ABI if we don't have to. As long as we don't have to make incompatible changes to functions, we can work around that by simply using a non-versioned library for the unit tests. Therefore we add a seperate rule here. Do this before actually adding a version script, to avoid breakage during bisection.
Quoted 73 lines
Signed-off-by Martin Wilck <[email protected]>--- libmultipath/Makefile | 7 +++++++ tests/Makefile | 10 ++++++---- 2 files changed, 13 insertions(+), 4 deletions(-)libmultipath/Makefile +7
-0@@ -74,6 +74,13 @@ $(LIBS): $(OBJS) $(DEVLIB): $(LIBS) $(LN) $(LIBS) $@ +../tests/$(LIBS): $(OBJS) $(VERSION_SCRIPT) + $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=`basename $@` \ + -o $@ $(OBJS) $(LIBDEPS) + $(LN) $@ ${@:.so.0=.so} + +test-lib: ../tests/$(LIBS) + install: all $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir) $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)tests/Makefile +6
-4@@ -10,7 +10,7 @@ W_MISSING_INITIALIZERS := $(call TEST_MISSING_INITIALIZERS) CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathcmddir) \ -Wno-unused-parameter $(W_MISSING_INITIALIZERS) -LIBDEPS += -L$(multipathdir) -L$(mpathcmddir) -lmultipath -lmpathcmd -lcmocka +LIBDEPS += -L. -L$(mpathcmddir) -lmultipath -lmpathcmd -lcmocka TESTS := uevent parser util dmevents hwtable blacklist unaligned vpd pgpolicy \ alias directio valid devt@@ -67,7 +67,7 @@ lib/libchecktur.so: %.out: %-test lib/libchecktur.so @echo == running $< == - @LD_LIBRARY_PATH=$(multipathdir):$(mpathcmddir) ./$< >$@ + @LD_LIBRARY_PATH=.:$(mpathcmddir) ./$< >$@ %.vgr: %-test lib/libchecktur.so @echo == running valgrind for $< ==@@ -77,7 +77,7 @@ lib/libchecktur.so: OBJS = $(TESTS:%=%.o) test-lib.o test_clean: - $(RM) $(TESTS:%=%.out) $(TESTS:%=%.vgr) + $(RM) $(TESTS:%=%.out) $(TESTS:%=%.vgr) *.so* valgrind_clean: $(RM) $(TESTS:%=%.vgr)@@ -97,12 +97,14 @@ dep_clean: @sed -n 's/^.*__wrap_\([a-zA-Z0-9_]*\).*$$/-Wl,--wrap=\1/p' $< | \ sort -u | tr '\n' ' ' >$@ +libmultipath.so.0: + $(MAKE) -C $(multipathdir) test-lib # COLON will get expanded during second expansion below COLON:=: .SECONDEXPANSION: %-test: %.o %.o.wrap $$($$@_OBJDEPS) $$($$@_TESTDEPS) $$($$@_TESTDEPS$$(COLON).o=.o.wrap) \ - $(multipathdir)/libmultipath.so Makefile + libmultipath.so.0 Makefile $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $< $($@_TESTDEPS) $($@_OBJDEPS) \ $(LIBDEPS) $($@_LIBDEPS) \ $(shell cat $<.wrap) $(foreach dep,$($@_TESTDEPS),$(shell cat $(dep).wrap))Signature · 1 line
2.28.0
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
PATCH v2 9/12 libmultipath: add linker version script
In reply to [email protected]From: Martin Wilck <[email protected]>
This version script documents the current ABI of libmultipath, as used by multipath, multipathd, (lib)mpathpersist, and the dynamically loaded libraries (prioritizers, checkers, and foreign). The initial version string is set to "LIBMULTIPATH_1.0.0".
This reduces the amount of exported symbols of libmultipath.so.0 by more than a half (199 vs. 434).
--- libmultipath/Makefile | 7 +- libmultipath/libmultipath.version | 248 ++++++++++++++++++++++++++++++ 2 files changed, 253 insertions(+), 2 deletions(-) create mode 100644 libmultipath/libmultipath.version
libmultipath/Makefile +5 -2
@@ -6,6 +6,7 @@ include ../Makefile.inc SONAME = 0 DEVLIB = libmultipath.so LIBS = $(DEVLIB).$(SONAME) +VERSION_SCRIPT := libmultipath.version CFLAGS += $(LIB_CFLAGS) -I$(mpathcmddir) -I$(mpathpersistdir) -I$(nvmedir)
@@ -68,8 +69,10 @@ nvme-ioctl.c: nvme/nvme-ioctl.c nvme-ioctl.h: nvme/nvme-ioctl.h $(call make_static,$<,$@) -$(LIBS): $(OBJS) - $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) + +$(LIBS): $(OBJS) $(VERSION_SCRIPT) + $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \ + -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS) $(DEVLIB): $(LIBS) $(LN) $(LIBS) $@
libmultipath/libmultipath.version new file +248 -0
248 lines not on this page · raw message
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
PATCH v2 10/12 libmpathpersist: add linker version script
In reply to [email protected]From: Martin Wilck <[email protected]>
This defines the ABI of libmpathpersist in the current state. The initial version is set to "LIBMPATHPERSIST_1.0.0".
--- libmpathpersist/Makefile | 6 +++-- libmpathpersist/libmpathpersist.version | 32 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 libmpathpersist/libmpathpersist.version
libmpathpersist/Makefile +4 -2
@@ -3,6 +3,7 @@ include ../Makefile.inc SONAME = 0 DEVLIB = libmpathpersist.so LIBS = $(DEVLIB).$(SONAME) +VERSION_SCRIPT := libmpathpersist.version CFLAGS += $(LIB_CFLAGS) -I$(multipathdir) -I$(mpathpersistdir) -I$(mpathcmddir)
@@ -13,8 +14,9 @@ OBJS = mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o all: $(DEVLIB) man -$(LIBS): $(OBJS) - $(CC) $(LDFLAGS) $(SHARED_FLAGS) $(LIBDEPS) -Wl,-soname=$@ -o $@ $(OBJS) +$(LIBS): $(OBJS) $(VERSION_SCRIPT) + $(CC) $(LDFLAGS) $(SHARED_FLAGS) $(LIBDEPS) -Wl,-soname=$@ \ + -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(DEVLIB): $(LIBS) $(LN) $(LIBS) $@
libmpathpersist/libmpathpersist.version new file +32 -0
@@ -0,0 +1,32 @@ +/* + * Copyright (c) 2020 SUSE LLC + * SPDX-License-Identifier: GPL-2.0-or-later + * + * libmpathpersist ABI + * + * The ABI of libmpathpersist is supposed to remain stable. Removing symbols + * or altering existing symbols' semantics is not allowed. When changing a + * a symbol, either use a new name, or explicit symver directives. + * + * See libmultipath.version for general policy about version numbers. + */ +LIBMPATHPERSIST_1.0.0 { +global: + + __mpath_persistent_reserve_in; + __mpath_persistent_reserve_out; + dumpHex; + mpath_alloc_prin_response; + mpath_lib_exit; + mpath_lib_init; + mpath_mx_alloc_len; + mpath_persistent_reserve_in; + mpath_persistent_reserve_init_vecs; + mpath_persistent_reserve_out; + mpath_persistent_reserve_free_vecs; + prin_do_scsi_ioctl; + prout_do_scsi_ioctl; + update_map_pr; + +local: *; +};
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
PATCH v2 11/12 libmpathcmd: add linker version script
In reply to [email protected]From: Martin Wilck <[email protected]>
For completeness, this isn't really necessary.
The version string is set to "LIBMPATHCMD_1.0.0".
--- libmpathcmd/Makefile | 6 ++++-- libmpathcmd/libmpathcmd.version | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 libmpathcmd/libmpathcmd.version
libmpathcmd/Makefile +4 -2
@@ -3,6 +3,7 @@ include ../Makefile.inc SONAME = 0 DEVLIB = libmpathcmd.so LIBS = $(DEVLIB).$(SONAME) +VERSION_SCRIPT := libmpathcmd.version CFLAGS += $(LIB_CFLAGS)
@@ -10,8 +11,9 @@ OBJS = mpath_cmd.o all: $(DEVLIB) -$(LIBS): $(OBJS) - $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) +$(LIBS): $(OBJS) $(VERSION_SCRIPT) + $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \ + -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS) $(DEVLIB): $(LIBS) $(LN) $(LIBS) $@
libmpathcmd/libmpathcmd.version new file +25 -0
@@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020 SUSE LLC + * SPDX-License-Identifier: GPL-2.0-or-later + * + * libmpathcmd ABI + * + * The ABI of libmpathcmd is supposed to remain stable. Removing symbols + * or altering existing symbols' semantics is not allowed. When changing a + * a symbol, either use a new name, or explicit symver directives. + * + * See libmultipath.version for general policy about version numbers. + */ +LIBMPATHCMD_1.0.0 { +global: + __mpath_connect; + mpath_connect; + mpath_disconnect; + mpath_process_cmd; + mpath_recv_reply; + mpath_recv_reply_len; + mpath_recv_reply_data; + mpath_send_cmd; +local: + *; +};
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
PATCH v2 12/12 libmpathpersist: initialize mpp->hwe in get_mpvec()
In reply to [email protected]From: Martin Wilck <[email protected]>
In __mpath_persistent_reserve_out, we call select_all_tg_pt(), which requires mpp->hwe to be set. Initialize it in get_mpvec().
--- libmpathpersist/mpath_persist.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
libmpathpersist/mpath_persist.c +4 -2
@@ -341,11 +341,13 @@ get_mpvec (vector curmp, vector pathvec, char * refwwid)continue ;if (update_multipath_table (mpp, pathvec,DI_CHECKER ) !=DMP_OK || -update_multipath_status (mpp) !=DMP_OK ) { +update_multipath_status (mpp) !=DMP_OK || +update_mpp_paths (mpp, pathvec)) {condlog (1 ,"error parsing map %s" , mpp->wwid);remove_map (mpp, pathvec, curmp,PURGE_VEC ); i--; - } + }else +extract_hwe_from_path (mpp); }return MPATH_PR_SUCCESS ; }
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] [PATCH v2 12/12] libmpathpersist: initialize mpp->hwe in get_mpvec()
Quoted 1 line · On Fri, Oct 16, 2020 at 12:42:39PM +0200, [email protected] wrote:
From: Martin Wilck <[email protected]>
Quoted 32 lines
In
__mpath_persistent_reserve_out, we callselect_all_tg_pt(), which requiresmpp->hweto be set. Initialize it inget_mpvec().Fixes 5b54e77 ("mpathpersist: add all_tg_pt option")Signed-off-by Martin Wilck <[email protected]>--- libmpathpersist/mpath_persist.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)libmpathpersist/mpath_persist.c +4
-2@@ -341,11 +341,13 @@ get_mpvec (vector curmp, vector pathvec, char * refwwid)continue ;if (update_multipath_table (mpp, pathvec,DI_CHECKER ) !=DMP_OK || -update_multipath_status (mpp) !=DMP_OK ) { +update_multipath_status (mpp) !=DMP_OK || +update_mpp_paths (mpp, pathvec)) {condlog (1 ,"error parsing map %s" , mpp->wwid);remove_map (mpp, pathvec, curmp,PURGE_VEC ); i--; - } + }else +extract_hwe_from_path (mpp); }return MPATH_PR_SUCCESS ; }Signature · 1 line
2.28.0
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel