multipath-tools: add linker version scripts
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.
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.
Regards,
Martin
Martin Wilck (11):
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
libdmmp/test/libdmmp_speed_test.c | 2 +- libdmmp/test/libdmmp_test.c | 2 +- libmpathcmd/Makefile | 14 +- libmpathcmd/libmpathcmd.version | 13 ++ libmpathpersist/Makefile | 16 +- libmpathpersist/libmpathpersist.version | 20 +++ libmultipath/Makefile | 22 ++- libmultipath/checkers.c | 17 ++ libmultipath/config.c | 2 +- libmultipath/configure.c | 7 + libmultipath/devmapper.c | 2 +- libmultipath/libmultipath.version | 215 ++++++++++++++++++++++++ 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 +- 20 files changed, 384 insertions(+), 72 deletions(-) create mode 100644 libmpathcmd/libmpathcmd.version create mode 100644 libmpathpersist/libmpathpersist.version create mode 100644 libmultipath/libmultipath.version
Signature · 1 line
2.28.0
PATCH 1/11 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 · 1 line
2.28.0
PATCH 2/11 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
@@ -421,6 +421,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 · 1 line
2.28.0
Benjamin Marzinski
maintainerRe: [PATCH 02/11] libmultipath: copy mpp->hwe from pp->hwe
Quoted 10 lines · On Thu, Sep 24, 2020 at 03:36:35PM +0200, [email protected] wrote:
From: Martin Wilck <[email protected]>
Since f0462f0 ("libmultipath: use vector for for
pp->hweandmp->hwe"), we've been trying to fix issues caused by paths getting freed andmpp->hwedangling. This approach couldn't work because we needmpp->hweto 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 setmpp->hweonly in two places,add_map_with_path()andsetup_map(), and that the code is simplified overall.
Unless I'm missing someting, it looks like __mpath_persistent_reserve_out() will call select_all_tg_pt(), which uses mpp->hwe, without ever setting it. Granted, I don't see how this was supposed to work before your patch either.
-Ben
Quoted 244 lines
Even now, it can happen that a map is added with
add_map_without_paths(), and has no paths. In that case, callingdo_set_from_hwe()with a NULL pointer is not a bug, so remove the message.Fixes f0462f0 ("libmultipath: use vector for for pp->hwe and mp->hwe")--- 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@@ -421,6 +421,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@@ -282,11 +282,6 @@ err:void orphan_path (struct path *pp,const char *reason) {condlog (3 ,"%s: orphan path, %s" , pp->dev, reason); -if (pp->mpp && pp->hwe && pp->mpp->hwe == pp->hwe) { -condlog (0 ,"BUG: orphaning path %s that holds hwe of %s" , - pp->dev, pp->mpp->alias); - pp->mpp->hwe =NULL ; - } pp->mpp =NULL ;uninitialize_path (pp); }@@ -296,8 +291,6 @@ void orphan_paths(vector pathvec, struct multipath *mpp, const char *reason)int i;struct path * pp; -/* Avoid BUG message from orphan_path() */ - mpp->hwe =NULL ; vector_foreach_slot (pathvec, pp, i) {if (pp->mpp == mpp) {if (pp->initialized ==INIT_REMOVED ) {@@ -385,24 +378,26 @@ extract_hwe_from_path(struct multipath * mpp)if (mpp->hwe || !mpp->paths)return ; -condlog (3 ,"%s: searching paths for valid hwe" , mpp->alias); +condlog (4 ,"%s: searching paths for valid hwe" , mpp->alias);/* doing this in two passes seems like paranoia to me */ vector_foreach_slot(mpp->paths, pp, i) { -if (pp->state !=PATH_UP ) -continue ; -if (pp->hwe) { - mpp->hwe = pp->hwe; -return ; - } +if (pp->state ==PATH_UP && + pp->initialized !=INIT_REMOVED && pp->hwe) + goto done; } vector_foreach_slot(mpp->paths, pp, i) { -if (pp->state ==PATH_UP ) -continue ; -if (pp->hwe) { - mpp->hwe = pp->hwe; -return ; - } +if (pp->state !=PATH_UP && + pp->initialized !=INIT_REMOVED && pp->hwe) + goto done; } +done: +if (i <VECTOR_SIZE (mpp->paths)) + (void )set_mpp_hwe (mpp, pp); + +if (mpp->hwe) +condlog (3 ,"%s: got hwe from path %s" , mpp->alias, pp->dev); +else +condlog (2 ,"%s: no hwe found" , mpp->alias); }int @@ -502,8 +497,6 @@ void sync_paths(struct multipath *mpp, vector pathvec) }if (!found) {condlog (3 ,"%s dropped path %s" , mpp->alias, pp->dev); -if (mpp->hwe == pp->hwe) - mpp->hwe =NULL ;vector_del_slot (mpp->paths, i--);orphan_path (pp,"path removed externally" ); }@@ -512,8 +505,6 @@ void sync_paths(struct multipath *mpp, vector pathvec)update_mpp_paths (mpp, pathvec);vector_foreach_slot (mpp->paths, pp, i) pp->mpp = mpp; -if (mpp->hwe ==NULL ) -extract_hwe_from_path (mpp); }int @@ -689,9 +680,15 @@ struct multipath *add_map_with_path(struct vectors *vecs, struct path *pp, conf =get_multipath_config (); mpp->mpe =find_mpe (conf->mptable, pp->wwid); - mpp->hwe = pp->hwe;put_multipath_config (conf); +/* +* We need to call this before select_alias(), +* because that accesses hwe properties. +*/ +if (pp->hwe && !set_mpp_hwe (mpp, pp)) + goto out; +strcpy (mpp->wwid, pp->wwid);find_existing_alias (mpp, vecs);if (select_alias (conf, mpp))@@ -742,12 +739,6 @@ int verify_paths(struct multipath *mpp)vector_del_slot (mpp->paths, i); 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 ;/* * Don't delete path from pathvec yet. We'll do this * after the path has been removed from the map, in @@ -759,7 +750,6 @@ int verify_paths(struct multipath *mpp) mpp->alias, pp->dev, pp->dev_t); } } -extract_hwe_from_path (mpp);return count; }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 · 1 line
2.28.0
Re: [PATCH 02/11] libmultipath: copy mpp->hwe from pp->hwe
Quoted 19 lines · Benjamin Marzinski
Quoted 4 lines · On Thu, Sep 24, 2020 at 03:36:35PM +0200, [email protected] wrote:
From: Martin Wilck <[email protected]>
Since f0462f0 ("libmultipath: use vector for for
pp->hweand mp-Quoted 1 line
hwe"),
Quoted 13 lines
we've been trying to fix issues caused by paths getting freed and
mpp->hwe
dangling. This approach couldn't work because we needmpp->hweto 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 setmpp->hweonly in two places,add_map_with_path()andsetup_map(), and
that the code is simplified overall.
Quoted 5 lines
Unless I'm missing someting, it looks like
__mpath_persistent_reserve_out()will callselect_all_tg_pt(), which usesmpp->hwe, without ever setting it. Granted, I don't see how this
was supposed to work before your patch either.
Right, it doesn't. Thanks for spotting it.
Ok to create a new, separate patch for it?
Regards,
Martin
Re: [PATCH 02/11] libmultipath: copy mpp->hwe from pp->hwe
Quoted 20 lines · Martin Wilck
Quoted 19 lines · Benjamin Marzinski
Quoted 17 lines · On Thu, Sep 24, 2020 at 03:36:35PM +0200, [email protected] wrote:
From: Martin Wilck <[email protected]>
Since f0462f0 ("libmultipath: use vector for for
pp->hweand mp-Quoted 1 line
hwe"),
we've been trying to fix issues caused by paths getting freed and
mpp->hwe
dangling. This approach couldn't work because we needmpp->hweto 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 setmpp->hweonly in two places,add_map_with_path()andsetup_map(), and
that the code is simplified overall.
Quoted 8 lines
Quoted 5 lines
Unless I'm missing someting, it looks like
__mpath_persistent_reserve_out()will callselect_all_tg_pt(), which usesmpp->hwe, without ever setting it. Granted, I don't see how this
was supposed to work before your patch either.Right, it doesn't. Thanks for spotting it.
Ok to create a new, separate patch for it?
Sure.
Quoted 4 lines
Regards,
Martin
PATCH 3/11 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 · 1 line
2.28.0
PATCH 4/11 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 · 1 line
2.28.0
PATCH 5/11 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 · 1 line
2.28.0
PATCH 6/11 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 · 1 line
2.28.0
Re: [PATCH 06/11] libmultipath: checkers/prio: allow non-lazy .so loading
Quoted 5 lines · On Thu, Sep 24, 2020 at 03:36:39PM +0200, [email protected] wrote:
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).
It seems like you could avoid having to remember to update these arrays when new checker or prio DSOs are added by just scanning multipath_dir for all the existing checkers/prioritizers. On the flip side, I'm not sure that's worth the extra work, and this way has the benefit of warning if any expected chekers/priotitizers are missing, so
Quoted 78 lines
--- 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 · 1 line
2.28.0
PATCH 7/11 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 · 1 line
2.28.0
PATCH 8/11 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 · 1 line
2.28.0
Benjamin Marzinski
maintainerRe: [PATCH 08/11] libmultipath: create separate .so for unit tests
Quoted 54 lines · On Thu, Sep 24, 2020 at 03:36:41PM +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.
--- 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 +2
-2@@ -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 $< ==
tests/Makefile lib/libchecktur.so: · line 80
Quoted 5 lines
tests/Makefile +1
-1@@ -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.*
Perhaps:
$(RM) $(TESTS:%=%.out) $(TESTS:%=%.vgr) *.so*
so you also remove libmultipath.so
-Ben
Quoted 21 lines
tests/Makefile +3
-1valgrind_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
PATCH 9/11 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).
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 | 215 ++++++++++++++++++++++++++++++ 2 files changed, 220 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 +215 -0
215 lines not on this page · raw message
Signature · 1 line
2.28.0
PATCH 10/11 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.
--- libmpathpersist/Makefile | 6 ++++-- libmpathpersist/libmpathpersist.version | 20 ++++++++++++++++++++ 2 files changed, 24 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 +20 -0
@@ -0,0 +1,20 @@ +LIBMPATHPERSIST_0.8.4.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 · 1 line
2.28.0
Benjamin Marzinski
maintainerRe: [PATCH 10/11] libmpathpersist: add linker version script
Quoted 39 lines · On Thu, Sep 24, 2020 at 03:36:43PM +0200, [email protected] wrote:
From: Martin Wilck <[email protected]>
This defines the ABI of libmpathpersist in the current state.
--- libmpathpersist/Makefile | 6 ++++-- libmpathpersist/libmpathpersist.version | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 libmpathpersist/libmpathpersist.versionlibmpathpersist/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 +0
-0
libmpathpersist/libmpathpersist.version line 1
Quoted 1 line
libmpathpersist/libmpathpersist.version new file +1
-0@@ -0,0 +1,20 @@ +LIBMPATHPERSIST_0.8.4.0 {
I have a question about this version. Do you plan on bumping this each time a new release is tagged? It seems like we only ever want to change the version if we actually change the ABI. Or is 0.8.4 just because that's the relesae where we started this?
-Ben
Quoted 21 lines
libmpathpersist/libmpathpersist.version new file +19
-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 · 1 line
2.28.0
Re: [PATCH 10/11] libmpathpersist: add linker version script
Quoted 13 lines · Benjamin Marzinski
libmpathpersist/libmpathpersist.version line 1
Quoted 5 lines · On Thu, Sep 24, 2020 at 03:36:43PM +0200, [email protected] wrote:
libmpathpersist/libmpathpersist.version new file +1
-0@@ -0,0 +1,20 @@ +LIBMPATHPERSIST_0.8.4.0 {I have a question about this version. Do you plan on bumping this each
time a new release is tagged? It seems like we only ever want to change
the version if we actually change the ABI. Or is 0.8.4 just because that's the relesae where we started this?
That was the idea, yes. And the last digit is because we'll have to bump it between releases from Christophe. It makes sense for libmultipath's rapidly changing ABI; much less so for libmpathcmd and libmpathpersist, which are meant to be stable. I am open for discussing these numbers; if you prefer, we might as well use LIBMPATHPERSIST_1.0.
I admit I haven't thought about what would happen once Christophe makes a new release. Probably, nothing - afaics it's impossible to add a new version without any new symbols, and *renaming* an existing version is bad; it would introduce artificial incompatibility.
So libmultipath from multipath-tools 0.8.5 would still have a 0.8.4.x ABI; only the first change after 0.8.5 would get a 0.8.5.1 number. Hm.
Again, I'm open for discussion here. We might as well choose to not tie the ABI version to the libmultipath version at all, and simply start at 0.1 or whatevever for libmultipath. After all, looking up the ABI version in the commit history will be simple enough.
Martin
Benjamin Marzinski
maintainerRe: [PATCH 10/11] libmpathpersist: add linker version script
Quoted 26 lines · Martin Wilck
Quoted 13 lines · Benjamin Marzinski
libmpathpersist/libmpathpersist.version line 1
Quoted 5 lines · On Thu, Sep 24, 2020 at 03:36:43PM +0200, [email protected] wrote:
libmpathpersist/libmpathpersist.version new file +1
-0@@ -0,0 +1,20 @@ +LIBMPATHPERSIST_0.8.4.0 {I have a question about this version. Do you plan on bumping this each
time a new release is tagged? It seems like we only ever want to change
the version if we actually change the ABI. Or is 0.8.4 just because that's the relesae where we started this?That was the idea, yes. And the last digit is because we'll have to bump it between releases from Christophe. It makes sense for libmultipath's rapidly changing ABI; much less so for libmpathcmd and libmpathpersist, which are meant to be stable. I am open for discussing these numbers; if you prefer, we might as well use LIBMPATHPERSIST_1.0.
I admit I haven't thought about what would happen once Christophe makes a new release. Probably, nothing - afaics it's impossible to add a new version without any new symbols, and *renaming* an existing version is bad; it would introduce artificial incompatibility.
Quoted 7 lines
So libmultipath from multipath-tools 0.8.5 would still have a 0.8.4.x ABI; only the first change after 0.8.5 would get a 0.8.5.1 number. Hm.
Again, I'm open for discussion here. We might as well choose to not tie the ABI version to the libmultipath version at all, and simply start at 0.1 or whatevever for libmultipath. After all, looking up the ABI version in the commit history will be simple enough.
Since the ABI version isn't always going to match the release version, I think it makes more sense to decouple them, so it's not sometimes matching and sometimes not. We could go with a MAJOR.MINOR versioning scheme, where we bump MINOR whenever we change the interface in a backwards compatible way (like by adding a new symbol), and bump the MAJOR and reset the MINOR whenever we change the interface in a non-backwards compatible way (like by changing the parameters an interface function takes, or removing a symbol). Although I'm not sure we need to be so careful for libmultipath, since that library isn't for external consumption.
-Ben
Quoted 2 lines
Martin
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Benjamin Marzinski
maintainerRe: [PATCH 10/11] libmpathpersist: add linker version script
Quoted 63 lines · Martin Wilck
Quoted 62 lines · Benjamin Marzinski
Quoted 60 lines · Benjamin Marzinski
Quoted 41 lines · Martin Wilck
Quoted 16 lines · Benjamin Marzinski
libmpathpersist/libmpathpersist.version line 1
Quoted 4 lines · On Thu, Sep 24, 2020 at 03:36:43PM +0200, [email protected] wrote:
libmpathpersist/libmpathpersist.version new file +1
-0@@ -0,0 +1,20 @@ +LIBMPATHPERSIST_0.8.4.0 {I have a question about this version. Do you plan on bumping this
each
time a new release is tagged? It seems like we only ever want to
change
the version if we actually change the ABI. Or is 0.8.4 just because
that's the relesae where we started this?That was the idea, yes. And the last digit is because we'll have to
bump it between releases from Christophe. It makes sense for libmultipath's rapidly changing ABI; much less so for libmpathcmd and
libmpathpersist, which are meant to be stable. I am open for discussing
these numbers; if you prefer, we might as well use LIBMPATHPERSIST_1.0.I admit I haven't thought about what would happen once Christophe makes
a new release. Probably, nothing - afaics it's impossible to add a new
version without any new symbols, and *renaming* an existing version is
bad; it would introduce artificial incompatibility.So libmultipath from multipath-tools 0.8.5 would still have a 0.8.4.x
ABI; only the first change after 0.8.5 would get a 0.8.5.1 number. Hm.Quoted 6 lines
Again, I'm open for discussion here. We might as well choose to not tie
the ABI version to the libmultipath version at all, and simply start at
0.1 or whatevever for libmultipath. After all, looking up the ABI version in the commit history will be simple enough.Since the ABI version isn't always going to match the release version, I
think it makes more sense to decouple them, so it's not sometimes matching and sometimes not. We could go with a MAJOR.MINOR versioning
scheme, where we bump MINOR whenever we change the interface in a backwards compatible way (like by adding a new symbol), and bump the
MAJOR and reset the MINOR whenever we change the interface in a non-backwards compatible way (like by changing the parameters an interface function takes, or removing a symbol).
Quoted 6 lines
Quoted 4 lines
Perhaps we might even want MAJOR.MINOR.RELEASE, where for upstream, RELEASE is always 0. Distros can increment it if they need to backport
changes, so that they don't conflict with existing upstream versions.Sounds good. What MAJOR.MINOR version should we start with? 0.1 ? 1.0?
I realize that multipath-tools doesn't actually have a 1.0 release, but 1.0+ releases tradiontially mean that you believe that it's stable and ready for use. Setting the libraries to 0.1 says to me that they aren't meant for serious use, so I would vote for 1.0.
cc-ing dm-devel, because apparently I forgot to on my last email.
-Ben
Quoted 2 lines
Martin
PATCH 11/11 libmpathcmd: add linker version script
In reply to [email protected]From: Martin Wilck <[email protected]>
For completeness, this isn't really necessary.
--- libmpathcmd/Makefile | 6 ++++-- libmpathcmd/libmpathcmd.version | 13 +++++++++++++ 2 files changed, 17 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 +13 -0
@@ -0,0 +1,13 @@ +LIBMPATHCMD_0.8.4.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 · 1 line
2.28.0
Quoted 19 lines · On Thu, Sep 24, 2020 at 03:36:33PM +0200, [email protected] wrote:
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.
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.
Quoted 6 lines
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.
For this patchset, except for 0002 and 0008
Quoted 43 lines
Regards,
MartinMartin Wilck (11):
libmultipath:find_mpe(): don't match with empty WWID
libmultipath: copympp->hwefrompp->hwe
libmultipath:dm_map_present_by_uuid(): fixdm_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 scriptlibdmmp/test/libdmmp_speed_test.c | 2 +- libdmmp/test/libdmmp_test.c | 2 +- libmpathcmd/Makefile | 14 +- libmpathcmd/libmpathcmd.version | 13 ++ libmpathpersist/Makefile | 16 +- libmpathpersist/libmpathpersist.version | 20 +++ libmultipath/Makefile | 22 ++- libmultipath/checkers.c | 17 ++ libmultipath/config.c | 2 +- libmultipath/configure.c | 7 + libmultipath/devmapper.c | 2 +- libmultipath/libmultipath.version | 215 ++++++++++++++++++++++++ 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 +- 20 files changed, 384 insertions(+), 72 deletions(-) create mode 100644 libmpathcmd/libmpathcmd.version create mode 100644 libmpathpersist/libmpathpersist.version create mode 100644 libmultipath/libmultipath.versionSignature · 1 line
2.28.0
Quoted 3 lines · Benjamin Marzinski
Reviewed-by Benjamin Marzinski <[email protected]>For this patchset, except for 0002 and 0008
Thanks a lot. I've fixes for both, will resubmit as soon as we have consensus about the ABI version numbering.
Martin