Misc multipath patches
Benjamin Marzinski
maintainercover Misc multipath patches
- patches 0001 and 0005 patch is some small unused code cleanup
- patches 0002 & 0003 are just some small bugfixes
- patch 0004 adds --param-alltgpt support to mpathpersist, since it appears to work correctly on devices that accept ALL_TG_PT
- patches 0006 & 0007 add a new method for blacklisting devices, "protocol", along with path wildcards to see the value of this for paths. I added this to deal with requests for being able to set multipath to only look at, for instancei, FC and iSCSI devices, without knowing beforehand what devices are going to be present on a system. There wasn't a set of udev properties that always worked to distinguish this for all devices, even if we could blacklist based on the values (which multipath currently can't).
- patch 0008 cleans up the blacklist filtering code, and fixes some printing inconsistencies. It does mean that when filter_path is called, all of the whitelist messages are printed, even if a path is eventually blacklisted. Of course the blacklist message is printed last, and there can already be prior whitelist messages in the logs from calls to the other filter_* functions.
- patch 0009 is a small change to the how the tests Makefile works, to make the unit tests compile on an older machine I tested on.
- patch 0010 is a new set of unit tests that validate the return codes and the messages printed by the blacklist filter_* functions.
Benjamin Marzinski (10):
libmultipath: remove last of rbd code
libmultipath: fix detect alua corner case
multipath: fix setting conf->version
mpathpersist: add --param-alltgpt option
libmutipath: remove unused IDE bus type
multipathd: add new protocol path wildcard
libmultipath: add "protocol" blacklist option.
libmultipath: remove _filter_* blacklist functions multipath tests: change to work with old make versions multipath tests: add blacklist tests
kpartx/del-part-nodes.rules | 2 +- libmpathpersist/mpath_persist.c | 10 +- libmultipath/blacklist.c | 177 +++++++------- libmultipath/blacklist.h | 5 +- libmultipath/config.c | 15 ++ libmultipath/config.h | 2 + libmultipath/configure.c | 2 +- libmultipath/devmapper.c | 6 +- libmultipath/dict.c | 14 +- libmultipath/discovery.c | 5 +- libmultipath/print.c | 74 ++++++ libmultipath/print.h | 2 + libmultipath/propsel.c | 4 +- libmultipath/structs.h | 2 - mpathpersist/main.c | 11 +- mpathpersist/main.h | 1 + mpathpersist/mpathpersist.8 | 4 + multipath/multipath.conf.5 | 24 +- tests/Makefile | 6 +- tests/blacklist.c | 512 ++++++++++++++++++++++++++++++++++++++++ 20 files changed, 762 insertions(+), 116 deletions(-) create mode 100644 tests/blacklist.c
Signature · 1 line
2.7.4
Benjamin Marzinski
maintainerPATCH 1/10 libmultipath: remove last of rbd code
My previous patch to remove the rbd code missed a little bit.
--- kpartx/del-part-nodes.rules | 2 +- libmultipath/structs.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
kpartx/del-part-nodes.rules +1 -1
@@ -10,7 +10,7 @@ # or create an udev rule file that sets ENV{DONT_DEL_PART_NODES}="1". SUBSYSTEM!="block", GOTO="end_del_part_nodes" -KERNEL!="sd*|dasd*|rbd*", GOTO="end_del_part_nodes" +KERNEL!="sd*|dasd*", GOTO="end_del_part_nodes" ACTION!="add|change", GOTO="end_del_part_nodes" ENV{DEVTYPE}=="partition", GOTO="end_del_part_nodes"
libmultipath/structs.h +0 -1
@@ -61,7 +61,6 @@ enum sysfs_buses {SYSFS_BUS_IDE ,SYSFS_BUS_CCW ,SYSFS_BUS_CCISS , -SYSFS_BUS_RBD , SYSFS_BUS_NVME, };
Signature · 1 line
2.7.4
Re: [PATCH 01/10] libmultipath: remove last of rbd code
Quoted 8 lines · Benjamin Marzinski
My previous patch to remove the rbd code missed a little bit.
Signed-off-by Benjamin Marzinski <[email protected]>--- kpartx/del-part-nodes.rules | 2 +- libmultipath/structs.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
Quoted 27 lines
kpartx/del-part- renamed from kpartx/del-part-nodes.rules +0
-0nodes.rules
index 17bc505..0ceecf5 100644kpartx/del-part-nodes.rules +0
-0@@ -10,7 +10,7 @@ # or create an udev rule file that setsENV{DONT_DEL_PART_NODES}="1".
SUBSYSTEM!="block", GOTO="end_del_part_nodes"
kpartx/del-part-nodes.rules +1
-1-KERNEL!="sd*|dasd*|rbd*", GOTO="end_del_part_nodes" +KERNEL!="sd*|dasd*", GOTO="end_del_part_nodes" ACTION!="add|change", GOTO="end_del_part_nodes" ENV{DEVTYPE}=="partition", GOTO="end_del_part_nodes"libmultipath/structs.h +0
-1@@ -61,7 +61,6 @@ enum sysfs_buses {SYSFS_BUS_IDE ,SYSFS_BUS_CCW ,SYSFS_BUS_CCISS , -SYSFS_BUS_RBD , SYSFS_BUS_NVME, };
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Re: [PATCH 01/10] libmultipath: remove last of rbd code
In reply to Benjamin MarzinskiQuoted 8 lines · Benjamin Marzinski
My previous patch to remove the rbd code missed a little bit.
Signed-off-by Benjamin Marzinski <[email protected]>--- kpartx/del-part-nodes.rules | 2 +- libmultipath/structs.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
Quoted 27 lines
kpartx/del-part- renamed from kpartx/del-part-nodes.rules +0
-0nodes.rules
index 17bc505..0ceecf5 100644kpartx/del-part-nodes.rules +0
-0@@ -10,7 +10,7 @@ # or create an udev rule file that setsENV{DONT_DEL_PART_NODES}="1".
SUBSYSTEM!="block", GOTO="end_del_part_nodes"
kpartx/del-part-nodes.rules +1
-1-KERNEL!="sd*|dasd*|rbd*", GOTO="end_del_part_nodes" +KERNEL!="sd*|dasd*", GOTO="end_del_part_nodes" ACTION!="add|change", GOTO="end_del_part_nodes" ENV{DEVTYPE}=="partition", GOTO="end_del_part_nodes"libmultipath/structs.h +0
-1@@ -61,7 +61,6 @@ enum sysfs_buses {SYSFS_BUS_IDE ,SYSFS_BUS_CCW ,SYSFS_BUS_CCISS , -SYSFS_BUS_RBD , SYSFS_BUS_NVME, };
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH 2/10 libmultipath: fix detect alua corner case
In reply to Benjamin MarzinskiIf retain_attach_hw_handler = no, then the paths tpgs state will never be checked, and the multipath device will always select the alua handler, if no other handler is selected. The paths tpgs state should be checked, regardless of the retain_hwhandler value.
--- libmultipath/propsel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
libmultipath/propsel.c +3 -1
@@ -420,9 +420,11 @@ int select_hwhandler(struct config *conf, struct multipath *mp)bool all_tpgs = true; dh_state = &handler[2 ]; + +vector_foreach_slot (mp->paths, pp, i) + all_tpgs = all_tpgs && (pp->tpgs > 0);if (mp->retain_hwhandler !=RETAIN_HWHANDLER_OFF ) { vector_foreach_slot(mp->paths, pp, i) { - all_tpgs = all_tpgs && (pp->tpgs >0 );if (get_dh_state (pp, dh_state,sizeof (handler) -2 ) >0 &&strcmp (dh_state,"detached" )) {memcpy (handler,"1 " ,2 );
Signature · 1 line
2.7.4
Re: [PATCH 02/10] libmultipath: fix detect alua corner case
Quoted 10 lines · Benjamin Marzinski
If
retain_attach_hw_handler= no, then the paths tpgs state will never
be checked, and the multipath device will always select the alua handler, if no other handler is selected. The paths tpgs state should be checked, regardless of theretain_hwhandlervalue.Signed-off-by Benjamin Marzinski <[email protected]>--- libmultipath/propsel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 20 lines
libmultipath/propsel.c +3
-1@@ -420,9 +420,11 @@ int select_hwhandler(struct config *conf, struct multipath *mp) bool all_tpgs = true; dh_state = &handler[2]; + + vector_foreach_slot(mp->paths, pp, i) + all_tpgs = all_tpgs && (pp->tpgs >0 );if (mp->retain_hwhandler !=RETAIN_HWHANDLER_OFF ) { vector_foreach_slot(mp->paths, pp, i) { - all_tpgs = all_tpgs && (pp->tpgs >0 ); if (get_dh_state(pp, dh_state,sizeof(handler) - 2) > 0
libmultipath/propsel.c +0
-0&& strcmp(dh_state, "detached")) {memcpy (handler,"1 " ,2 );
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Re: [PATCH 02/10] libmultipath: fix detect alua corner case
In reply to Benjamin MarzinskiQuoted 10 lines · Benjamin Marzinski
If
retain_attach_hw_handler= no, then the paths tpgs state will never
be checked, and the multipath device will always select the alua handler, if no other handler is selected. The paths tpgs state should be checked, regardless of theretain_hwhandlervalue.Signed-off-by Benjamin Marzinski <[email protected]>--- libmultipath/propsel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 22 lines
libmultipath/propsel.c +3
-1@@ -420,9 +420,11 @@ int select_hwhandler(struct config *conf, struct multipath *mp) bool all_tpgs = true; dh_state = &handler[2]; + + vector_foreach_slot(mp->paths, pp, i) + all_tpgs = all_tpgs && (pp->tpgs >0 );if (mp->retain_hwhandler !=RETAIN_HWHANDLER_OFF ) { vector_foreach_slot(mp->paths, pp, i) { - all_tpgs = all_tpgs && (pp->tpgs >0 ); if (get_dh_state(pp, dh_state,sizeof(handler) - 2) > 0
libmultipath/propsel.c +0
-0&& strcmp(dh_state, "detached")) {memcpy (handler,"1 " ,2 );
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH 3/10 multipath: fix setting conf->version
In reply to Benjamin MarzinskiCommit d3b71498 stopped multipath from setting conf->version. Instead, it was always being set to 0.0.0. Multipathd was still setting this correctly.
--- libmultipath/devmapper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
libmultipath/devmapper.c +3 -3
@@ -245,13 +245,13 @@ void libmp_dm_init(void)int verbosity;unsigned int version[3 ]; +if (dm_prereq (version)) +exit (1 ); conf =get_multipath_config (); verbosity = conf->verbosity; -memcpy (version, conf->version,sizeof (version)); +memcpy (conf->version, version,sizeof (version));put_multipath_config (conf);dm_init (verbosity); -if (dm_prereq (version)) -exit (1 );dm_udev_set_sync_support (libmp_dm_udev_sync); }
Signature · 1 line
2.7.4
Re: [PATCH 03/10] multipath: fix setting conf->version
Quoted 11 lines · Benjamin Marzinski
Commit
d3b71498stopped multipath from settingconf->version. Instead,
it was always being set to 0.0.0. Multipathd was still setting this correctly.Fixes d3b71498 "multipath: fix rcu thread cancellation hang"Signed-off-by Benjamin Marzinski <[email protected]>--- libmultipath/devmapper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 21 lines
libmultipath/devmapper.c +3
-3@@ -245,13 +245,13 @@ void libmp_dm_init(void)int verbosity;unsigned int version[3 ]; +if (dm_prereq (version)) +exit (1 ); conf =get_multipath_config (); verbosity = conf->verbosity; -memcpy (version, conf->version,sizeof (version)); +memcpy (conf->version, version,sizeof (version));put_multipath_config (conf);dm_init (verbosity); -if (dm_prereq (version)) -exit (1 );dm_udev_set_sync_support (libmp_dm_udev_sync); }
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH 4/10 mpathpersist: add --param-alltgpt option
In reply to Benjamin MarzinskiFrom the limited testing I've been able to do, commit 5b54e772 "mpathpersist: add all_tg_pt option", does appear to enable --param-alltgpt to work correctly on devices that accept the ALL_TG_PT flag, so I've added the option to mpathpersist.
--- libmpathpersist/mpath_persist.c | 10 ++++------ mpathpersist/main.c | 11 ++++++++--- mpathpersist/main.h | 1 + mpathpersist/mpathpersist.8 | 4 ++++ multipath/multipath.conf.5 | 8 +++++--- 5 files changed, 22 insertions(+), 12 deletions(-)
libmpathpersist/mpath_persist.c +4 -6
@@ -466,11 +466,14 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,int rc;int count=0 ;int status =MPATH_PR_SUCCESS ; +int all_tg_pt;uint64_t sa_key =0 ;if (!mpp)return MPATH_PR_DMMP_ERROR ; + all_tg_pt = (mpp->all_tg_pt ==ALL_TG_PT_ON || + paramp->sa_flags &MPATH_F_ALL_TG_PT_MASK ); active_pathcount =pathcount (mpp,PATH_UP ) +pathcount (mpp,PATH_GHOST );if (active_pathcount ==0 ) {
@@ -478,10 +481,6 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,return MPATH_PR_DMMP_ERROR ; } -if ( paramp->sa_flags &MPATH_F_ALL_TG_PT_MASK ) { -condlog (1 ,"Warning: ALL_TG_PT is set. Configuration not supported" ); - } -struct threadinfo thread[active_pathcount];int hosts[active_pathcount];
@@ -518,8 +517,7 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,condlog (1 ,"%s: %s path not up. Skip." , mpp->wwid, pp->dev);continue ; } -if (mpp->all_tg_pt ==ALL_TG_PT_ON && - pp->sg_id.host_no !=-1 ) { +if (all_tg_pt && pp->sg_id.host_no !=-1 ) {for (k =0 ; k < count; k++) {if (pp->sg_id.host_no == hosts[k]) {condlog (3 ,"%s: %s host %d matches skip." , pp->wwid, pp->dev, pp->sg_id.host_no);
mpathpersist/main.c +8 -3
@@ -118,7 +118,7 @@ int main (int argc, char * argv[]) {int option_index =0 ; - c =getopt_long (argc, argv,"v:Cd:hHioZK:S:PAT:skrGILcRX:l:" , + c =getopt_long (argc, argv,"v:Cd:hHioYZK:S:PAT:skrGILcRX:l:" , long_options, &option_index);if (c ==-1 )break ;
@@ -158,6 +158,10 @@ int main (int argc, char * argv[]) prout_flag =1 ;break ; +case 'Y' : + param_alltgpt =1 ; + ++num_prout_param; +break ;case 'Z' : param_aptpl =1 ; ++num_prout_param;
@@ -443,9 +447,9 @@ int main (int argc, char * argv[]) }if (param_alltgpt) - paramp->sa_flags |=0x4 ; + paramp->sa_flags |=MPATH_F_ALL_TG_PT_MASK ;if (param_aptpl) - paramp->sa_flags |=0x1 ; + paramp->sa_flags |=MPATH_F_APTPL_MASK ;if (num_transport) {
@@ -698,6 +702,7 @@ static void usage(void)" --hex|-H output response in hex\n" " --in|-i request PR In command \n" " --out|-o request PR Out command\n" +" --param-alltgpt|-Y PR Out parameter 'ALL_TG_PT\n" " --param-aptpl|-Z PR Out parameter 'APTPL'\n" " --read-keys|-k PR In: Read Keys\n" " --param-sark=SARK|-S SARK PR Out parameter service "
mpathpersist/main.h +1 -0
@@ -6,6 +6,7 @@ static struct option long_options[] = { {"hex", 0, NULL, 'H'}, {"in", 0, NULL, 'i'}, {"out", 0, NULL, 'o'}, + {"param-alltgpt", 0, NULL, 'Y'}, {"param-aptpl", 0, NULL, 'Z'}, {"param-rk", 1, NULL, 'K'}, {"param-sark", 1, NULL, 'S'},
mpathpersist/mpathpersist.8 +4 -0
@@ -87,6 +87,10 @@ Request PR In command. Request PR Out command. . .TP +.B \--param-alltgpt|\-Y +PR Out parameter 'ALL_TG_PT'. +. +.TP .B \--param-aptpl|\-Z PR Out parameter 'APTPL'. .
multipath/multipath.conf.5 +5 -3
@@ -756,9 +756,11 @@ The default is: \fB<unset>\fR . .TP .B all_tg_pt -This must be set to \fByes\fR to successfully use mpathpersist on arrays that -automatically set and clear registration keys on all target ports from a -host, instead of per target port per host. +Set the 'all targets ports' flag when registering keys with mpathpersist. Some +arrays automatically set and clear registration keys on all target ports from a +host, instead of per target port per host. The ALL_TG_PT flag must be set to +successfully use mpathpersist on these arrays. Setting this option is identical +to calling mpathpersist with \fI--param-alltgpt\fR .RS .TP The default is: \fBno\fR
Signature · 1 line
2.7.4
Re: [PATCH 04/10] mpathpersist: add --param-alltgpt option
Quoted 6 lines · Benjamin Marzinski
From the limited testing I've been able to do, commit
5b54e772"mpathpersist: addall_tg_ptoption", does appear to enable --param-alltgpt to work correctly on devices that accept theALL_TG_PT
flag, so I've added the option to mpathpersist.
Quoted 9 lines
Signed-off-by Benjamin Marzinski <[email protected]>--- libmpathpersist/mpath_persist.c | 10 ++++------ mpathpersist/main.c | 11 ++++++++--- mpathpersist/main.h | 1 + mpathpersist/mpathpersist.8 | 4 ++++ multipath/multipath.conf.5 | 8 +++++--- 5 files changed, 22 insertions(+), 12 deletions(-)
Quoted 155 lines
libmpathpersist/mpath_persist.c +3
-0@@ -466,11 +466,14 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope, int rc;int count=0 ;int status =MPATH_PR_SUCCESS ; +int all_tg_pt;uint64_t sa_key =0 ;if (!mpp)return MPATH_PR_DMMP_ERROR ; + all_tg_pt = (mpp->all_tg_pt ==ALL_TG_PT_ON || + paramp->sa_flags &MPATH_F_ALL_TG_PT_MASK ); active_pathcount =pathcount (mpp,PATH_UP ) +pathcount (mpp,PATH_GHOST );libmpathpersist/mpath_persist.c +0
-4if (active_pathcount ==0 ) {@@ -478,10 +481,6 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope, return MPATH_PR_DMMP_ERROR; } -if ( paramp->sa_flags &MPATH_F_ALL_TG_PT_MASK ) { - condlog (1, "Warning: ALL_TG_PT is set. Configuration not supported"); - } - struct threadinfo thread[active_pathcount];libmpathpersist/mpath_persist.c +1
-2int hosts[active_pathcount];@@ -518,8 +517,7 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope, condlog (1, "%s: %s path not up. Skip.", mpp->wwid, pp->dev);continue ; } -if (mpp->all_tg_pt ==ALL_TG_PT_ON && - pp->sg_id.host_no !=-1 ) { +if (all_tg_pt && pp->sg_id.host_no !=-1 ) {for (k =0 ; k < count; k++) {if (
pp->sg_id.host_no==
hosts[k]) {
condlog(3, "%s: %s
host %d matches skip.",pp->wwid,pp->dev,pp->sg_id.host_no);mpathpersist/main.c +1
-1@@ -118,7 +118,7 @@ int main (int argc, char * argv[]) {int option_index =0 ; - c =getopt_long (argc, argv,"v:Cd:hHioZK:S:PAT:skrGILcRX:l:" , + c =getopt_long (argc, argv,"v:Cd:hHioYZK:S:PAT:skrGILcRX:l:" , long_options, &option_index);mpathpersist/main.c +6
-2if (c ==-1 )break ;@@ -158,6 +158,10 @@ int main (int argc, char * argv[]) prout_flag =1 ;break ; +case 'Y' : + param_alltgpt =1 ; + ++num_prout_param; +break ;case 'Z' : param_aptpl =1 ; ++num_prout_param;@@ -443,9 +447,9 @@ int main (int argc, char * argv[]) }if (param_alltgpt) - paramp->sa_flags |=0x4 ; + paramp->sa_flags |=MPATH_F_ALL_TG_PT_MASK ;if (param_aptpl) - paramp->sa_flags |=0x1 ; + paramp->sa_flags |=MPATH_F_APTPL_MASK ;if (num_transport) {@@ -698,6 +702,7 @@ static void usage(void) " --hex|-H outputresponse in hex\n"
" --in|-i request PR
In command \n"
" --out|-o request PR
Out command\n"mpathpersist/main.c +1
-0+ " --param-alltgpt|-Y PR Outparameter 'ALL_TG_PT\n"
" --param-aptpl|-Z PR Out
parameter 'APTPL'\n"
" --read-keys|-k PR In: Read
Keys\n"
" --param-sark=SARK|-S SARK PR Out
parameter service "mpathpersist/main.h +1
-0@@ -6,6 +6,7 @@ static struct option long_options[] = { {"hex", 0, NULL, 'H'}, {"in", 0, NULL, 'i'}, {"out", 0, NULL, 'o'}, + {"param-alltgpt", 0, NULL, 'Y'}, {"param-aptpl", 0, NULL, 'Z'}, {"param-rk", 1, NULL, 'K'}, {"param-sark", 1, NULL, 'S'},mpathpersist/mpathpersist.8 +4
-0@@ -87,6 +87,10 @@ Request PR In command. Request PR Out command. . .TP +.B \--param-alltgpt|\-Y +PR Out parameter 'ALL_TG_PT'. +. +.TP .B \--param-aptpl|\-Z PR Out parameter 'APTPL'. .multipath/multipath.conf.5 +0
-1@@ -756,9 +756,11 @@ The default is: \fB<unset>\fR . .TP .B all_tg_pt -This must be set to \fByes\fR to successfully use mpathpersist onarrays that
-automatically set and clear registration keys on all target ports from amultipath/multipath.conf.5 +1
-1-host, instead of per target port per host. +Set the 'all targets ports' flag when registering keys withmpathpersist. Some
+arrays automatically set and clear registration keys on all target ports from a
+host, instead of per target port per host. TheALL_TG_PTflag must be set to
+successfully use mpathpersist on these arrays. Setting this option is identical
+to calling mpathpersist with \fI--param-alltgpt\fR
.RS
.TP
The default is: \fBno\fR
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH 5/10 libmutipath: remove unused IDE bus type
In reply to Benjamin Marzinski--- libmultipath/structs.h | 1 - 1 file changed, 1 deletion(-)
libmultipath/structs.h +0 -1
@@ -58,7 +58,6 @@ enum failback_mode {enum sysfs_buses {SYSFS_BUS_UNDEF ,SYSFS_BUS_SCSI , -SYSFS_BUS_IDE ,SYSFS_BUS_CCW ,SYSFS_BUS_CCISS ,SYSFS_BUS_NVME ,
Signature · 1 line
2.7.4
Re: [PATCH 05/10] libmutipath: remove unused IDE bus type
Quoted 5 lines · Benjamin Marzinski
Signed-off-by Benjamin Marzinski <[email protected]>--- libmultipath/structs.h | 1 - 1 file changed, 1 deletion(-)
Quoted 12 lines
libmultipath/structs.h +0
-1@@ -58,7 +58,6 @@ enum failback_mode {enum sysfs_buses {SYSFS_BUS_UNDEF ,SYSFS_BUS_SCSI , -SYSFS_BUS_IDE ,SYSFS_BUS_CCW ,SYSFS_BUS_CCISS ,SYSFS_BUS_NVME ,
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH 6/10 multipathd: add new protocol path wildcard
In reply to Benjamin MarzinskiThis patch adds a new path wildcard 'P', that will print the path's protocol. For scsi devices, it will additionally print the transport protocol being used.
--- libmultipath/print.c | 43 +++++++++++++++++++++++++++++++++++++++++++ libmultipath/print.h | 2 ++ 2 files changed, 45 insertions(+)
libmultipath/print.c +43 -0
@@ -638,6 +638,48 @@ snprint_path_failures(char * buff, size_t len, const struct path * pp)return snprint_int (buff, len, pp->failcount); } +/* if you add a protocol string bigger than "scsi:unspec" you must +* also change PROTOCOL_BUF_SIZE */ +int +snprint_path_protocol (char * buff,size_t len,const struct path * pp) +{ +switch (pp->bus) { +case SYSFS_BUS_SCSI : +switch (pp->sg_id.proto_id) { +case SCSI_PROTOCOL_FCP : +return snprintf (buff, len,"scsi:fcp" ); +case SCSI_PROTOCOL_SPI : +return snprintf (buff, len,"scsi:spi" ); +case SCSI_PROTOCOL_SSA : +return snprintf (buff, len,"scsi:ssa" ); +case SCSI_PROTOCOL_SBP : +return snprintf (buff, len,"scsi:sbp" ); +case SCSI_PROTOCOL_SRP : +return snprintf (buff, len,"scsi:srp" ); +case SCSI_PROTOCOL_ISCSI : +return snprintf (buff, len,"scsi:iscsi" ); +case SCSI_PROTOCOL_SAS : +return snprintf (buff, len,"scsi:sas" ); +case SCSI_PROTOCOL_ADT : +return snprintf (buff, len,"scsi:adt" ); +case SCSI_PROTOCOL_ATA : +return snprintf (buff, len,"scsi:ata" ); +case SCSI_PROTOCOL_UNSPEC : +default : +return snprintf (buff, len,"scsi:unspec" ); + } +case SYSFS_BUS_CCW : +return snprintf (buff, len,"ccw" ); +case SYSFS_BUS_CCISS : +return snprintf (buff, len,"cciss" ); +case SYSFS_BUS_NVME : +return snprintf (buff, len,"nvme" ); +case SYSFS_BUS_UNDEF : +default : +return snprintf (buff, len,"undef" ); + } +} +struct multipath_data mpd[] = { {'n' ,"name" ,0 , snprint_name}, {'w' ,"uuid" ,0 , snprint_multipath_uuid},
@@ -687,6 +729,7 @@ struct path_data pd[] = { {'a', "host adapter", 0, snprint_host_adapter}, {'G', "foreign", 0, snprint_path_foreign}, {'0', "failures", 0, snprint_path_failures}, + {'P', "protocol", 0, snprint_path_protocol}, {0, NULL, 0 , NULL} };
libmultipath/print.h +2 -0
@@ -133,6 +133,8 @@ int snprint_host_wwnn (char *, size_t, const struct path *);int snprint_host_wwpn (char *,size_t ,const struct path *);int snprint_tgt_wwnn (char *,size_t ,const struct path *);int snprint_tgt_wwpn (char *,size_t ,const struct path *); +#define PROTOCOL_BUF_SIZE sizeof("scsi:unspec") +int snprint_path_protocol (char *,size_t ,const struct path *);void _print_multipath_topology (const struct gen_multipath * gmp,int verbosity);
Signature · 1 line
2.7.4
Re: [PATCH 06/10] multipathd: add new protocol path wildcard
Quoted 10 lines · Benjamin Marzinski
This patch adds a new path wildcard 'P', that will print the path's protocol. For scsi devices, it will additionally print the transport protocol being used.
Signed-off-by Benjamin Marzinski <[email protected]>--- libmultipath/print.c | 43 +++++++++++++++++++++++++++++++++++++++++++ libmultipath/print.h | 2 ++ 2 files changed, 45 insertions(+)
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH 7/10 libmultipath: add "protocol" blacklist option.
In reply to Benjamin MarzinskiMultiple users have requested an easy way to setup blacklists that do things such as blacklisting all non FC and iSCSI devices. Currently there is no easy way to do this, without knowing in advance what the devices are. Looking into the udev property values, I didn't see a consistent set of values that would worked for all the different types of requests like this (which would have allowed us to solve this by extending the "property" blacklist option to allow comparing values, instead of just keywords).
Instead I've opted to allow multipath to blacklist/whitelist devices by the protocol strings printed by "multipathd: add new protocol path wildcard". This check happens after multipath checks the "device" keyword, and before it checks wwid. This gives users an easily understandible method to set up these types of blacklists, without needing to know the exact arrays being used.
--- libmultipath/blacklist.c | 51 ++++++++++++++++++++++++++++++++++++++-------- libmultipath/blacklist.h | 3 +++ libmultipath/config.c | 15 ++++++++++++++ libmultipath/config.h | 2 ++ libmultipath/dict.c | 14 +++++++++++-- libmultipath/discovery.c | 5 +++-- libmultipath/print.c | 31 ++++++++++++++++++++++++++++ multipath/multipath.conf.5 | 16 +++++++++++++-- 8 files changed, 123 insertions(+), 14 deletions(-)
libmultipath/blacklist.c +43 -8
@@ -12,6 +12,8 @@#include "structs.h" #include "config.h" #include "blacklist.h" +#include "structs_vec.h" +#include "print.h" int store_ble (vector blist,char * str,int origin) {
@@ -240,12 +242,14 @@ setup_default_blist (struct config * conf)condlog (3 ,"%s: %s %s %s" , dev, (M ), wwid, (S )); \ else if (env) \ condlog(3, "%s: %s %s %s", dev, (M), env, (S)); \ + else if (protocol) \ + condlog(3, "%s: %s %s %s", dev, (M), protocol, (S)); \ else \ condlog(3, "%s: %s %s", dev, (M), (S))void log_filter (const char *dev,char *vendor,char *product,char *wwid, -const char *env,int r) +const char *env,const char *protocol,int r) {/* * Try to sort from most likely to least.
@@ -265,6 +269,9 @@ log_filter (const char *dev, char *vendor, char *product, char *wwid,case MATCH_PROPERTY_BLIST :LOG_BLIST ("udev property" ,"blacklisted" );break ; +case MATCH_PROTOCOL_BLIST : +LOG_BLIST ("protocol" ,"blacklisted" ); +break ;case MATCH_DEVICE_BLIST_EXCEPT :LOG_BLIST ("vendor/product" ,"whitelisted" );break ;
@@ -280,6 +287,9 @@ log_filter (const char *dev, char *vendor, char *product, char *wwid,case MATCH_PROPERTY_BLIST_MISSING :LOG_BLIST ("blacklisted," ,"udev property missing" );break ; +case MATCH_PROTOCOL_BLIST_EXCEPT : +LOG_BLIST ("protocol" ,"whitelisted" ); +break ; } }
@@ -299,7 +309,7 @@ int filter_device (vector blist, vector elist, char * vendor, char * product) { int r = _filter_device(blist, elist, vendor, product); -log_filter (NULL , vendor, product,NULL ,NULL , r); +log_filter (NULL , vendor, product,NULL ,NULL ,NULL , r);return r; }
@@ -319,7 +329,7 @@ int filter_devnode (vector blist, vector elist, char * dev) { int r = _filter_devnode(blist, elist, dev); -log_filter (dev,NULL ,NULL ,NULL ,NULL , r); +log_filter (dev,NULL ,NULL ,NULL ,NULL ,NULL , r);return r; }
@@ -339,7 +349,29 @@ int filter_wwid (vector blist, vector elist, char * wwid, char * dev) { int r = _filter_wwid(blist, elist, wwid); -log_filter (dev,NULL ,NULL , wwid,NULL , r); +log_filter (dev,NULL ,NULL , wwid,NULL ,NULL , r); +return r; +} + +static int +_filter_protocol (vector blist,vector elist,const char * protocol_str) +{ +if (_blacklist_exceptions (elist, protocol_str)) +return MATCH_PROTOCOL_BLIST_EXCEPT ; +if (_blacklist (blist, protocol_str)) +return MATCH_PROTOCOL_BLIST ; +return 0 ; +} + +int +filter_protocol (vector blist,vector elist,struct path * pp) +{ +char buf[PROTOCOL_BUF_SIZE ]; +int r; + +snprint_path_protocol (buf,sizeof (buf), pp); + r =_filter_protocol (blist, elist, buf); +log_filter (pp->dev,NULL ,NULL ,NULL ,NULL , buf, r);return r; }
@@ -351,7 +383,6 @@ _filter_path (struct config * conf, struct path * pp) r =filter_property (conf, pp->udev);if (r >0 )return r; - r =_filter_devnode (conf->blist_devnode, conf->elist_devnode,pp->dev);if (r >0 )return r;
@@ -359,6 +390,9 @@ _filter_path (struct config * conf, struct path * pp) pp->vendor_id, pp->product_id);if (r >0 )return r; + r =filter_protocol (conf->blist_protocol, conf->elist_protocol, pp); +if (r >0 ) +return r; r =_filter_wwid (conf->blist_wwid, conf->elist_wwid, pp->wwid);return r; }
@@ -367,7 +401,8 @@ int filter_path (struct config * conf, struct path * pp) { int r=_filter_path(conf, pp); -log_filter (pp->dev, pp->vendor_id, pp->product_id, pp->wwid,NULL , r); +log_filter (pp->dev, pp->vendor_id, pp->product_id, pp->wwid,NULL , +NULL , r);return r; }
@@ -402,7 +437,7 @@ filter_property(struct config * conf, struct udev_device * udev) r =_filter_property (conf, env);if (r) { -log_filter (devname,NULL ,NULL ,NULL , env, r); +log_filter (devname,NULL ,NULL ,NULL , env,NULL , r);return r; } }
@@ -411,7 +446,7 @@ filter_property(struct config * conf, struct udev_device * udev)* This is the inverse of the 'normal' matching; * the environment variable _has_ to match. */ -log_filter (devname,NULL ,NULL ,NULL ,NULL , +log_filter (devname,NULL ,NULL ,NULL ,NULL ,NULL ,MATCH_PROPERTY_BLIST_MISSING );return MATCH_PROPERTY_BLIST_MISSING ; }
libmultipath/blacklist.h +3 -0
@@ -10,10 +10,12 @@#define MATCH_DEVNODE_BLIST 3#define MATCH_PROPERTY_BLIST 4#define MATCH_PROPERTY_BLIST_MISSING 5 +#define MATCH_PROTOCOL_BLIST 6#define MATCH_WWID_BLIST_EXCEPT -MATCH_WWID_BLIST#define MATCH_DEVICE_BLIST_EXCEPT -MATCH_DEVICE_BLIST#define MATCH_DEVNODE_BLIST_EXCEPT -MATCH_DEVNODE_BLIST#define MATCH_PROPERTY_BLIST_EXCEPT -MATCH_PROPERTY_BLIST +#define MATCH_PROTOCOL_BLIST_EXCEPT -MATCH_PROTOCOL_BLISTstruct blentry {char * str;
@@ -36,6 +38,7 @@ int filter_wwid (vector, vector, char *, char *);int filter_device (vector ,vector ,char *,char *);int filter_path (struct config *,struct path *);int filter_property (struct config *,struct udev_device *); +int filter_protocol (vector ,vector ,struct path *);int store_ble (vector ,char *,int );int set_ble_device (vector ,char *,char *,int );void free_blacklist (vector );
libmultipath/config.c +15 -0
@@ -623,11 +623,13 @@ free_config (struct config * conf)free_blacklist (conf->blist_devnode);free_blacklist (conf->blist_wwid);free_blacklist (conf->blist_property); +free_blacklist (conf->blist_protocol);free_blacklist_device (conf->blist_device);free_blacklist (conf->elist_devnode);free_blacklist (conf->elist_wwid);free_blacklist (conf->elist_property); +free_blacklist (conf->elist_protocol);free_blacklist_device (conf->elist_device);free_mptable (conf->mptable);
@@ -780,6 +782,12 @@ load_config (char * file)if (!conf->blist_property) goto out; } +if (conf->blist_protocol ==NULL ) { + conf->blist_protocol =vector_alloc (); + +if (!conf->blist_protocol) + goto out; + }if (conf->elist_devnode ==NULL ) { conf->elist_devnode =vector_alloc ();
@@ -807,6 +815,13 @@ load_config (char * file)if (!conf->elist_property) goto out; } +if (conf->elist_protocol ==NULL ) { + conf->elist_protocol =vector_alloc (); + +if (!conf->elist_protocol) + goto out; + } +if (setup_default_blist (conf)) goto out;
libmultipath/config.h +2 -0
@@ -210,10 +210,12 @@ struct config {vector blist_wwid;vector blist_device;vector blist_property; +vector blist_protocol;vector elist_devnode;vector elist_wwid;vector elist_device;vector elist_property; +vector elist_protocol; };extern struct udev * udev;
libmultipath/dict.c +12 -2
@@ -1291,9 +1291,12 @@ blacklist_handler(struct config *conf, vector strvec) conf->blist_device =vector_alloc ();if (!conf->blist_property) conf->blist_property =vector_alloc (); +if (!conf->blist_protocol) + conf->blist_protocol =vector_alloc ();if (!conf->blist_devnode || !conf->blist_wwid || - !conf->blist_device || !conf->blist_property) + !conf->blist_device || !conf->blist_property || + !conf->blist_protocol)return 1 ;return 0 ;
@@ -1310,9 +1313,12 @@ blacklist_exceptions_handler(struct config *conf, vector strvec) conf->elist_device =vector_alloc ();if (!conf->elist_property) conf->elist_property =vector_alloc (); +if (!conf->elist_protocol) + conf->elist_protocol =vector_alloc ();if (!conf->elist_devnode || !conf->elist_wwid || - !conf->elist_device || !conf->elist_property) + !conf->elist_device || !conf->elist_property || + !conf->elist_protocol)return 1 ;return 0 ;
@@ -1356,6 +1362,8 @@ declare_ble_handler(blist_wwid) declare_ble_handler(elist_wwid) declare_ble_handler(blist_property) declare_ble_handler(elist_property) +declare_ble_handler(blist_protocol) +declare_ble_handler(elist_protocol) static int snprint_def_uxsock_timeout(struct config *conf, char * buff, int len,
@@ -1627,6 +1635,7 @@ init_keywords(vector keywords)install_keyword_multi ("devnode" , &ble_blist_devnode_handler, &snprint_ble_simple);install_keyword_multi ("wwid" , &ble_blist_wwid_handler, &snprint_ble_simple);install_keyword_multi ("property" , &ble_blist_property_handler, &snprint_ble_simple); +install_keyword_multi ("protocol" , &ble_blist_protocol_handler, &snprint_ble_simple);install_keyword_multi ("device" , &ble_device_handler,NULL );install_sublevel ();install_keyword ("vendor" , &ble_blist_device_vendor_handler, &snprint_bled_vendor);
@@ -1636,6 +1645,7 @@ init_keywords(vector keywords)install_keyword_multi ("devnode" , &ble_elist_devnode_handler, &snprint_ble_simple);install_keyword_multi ("wwid" , &ble_elist_wwid_handler, &snprint_ble_simple);install_keyword_multi ("property" , &ble_elist_property_handler, &snprint_ble_simple); +install_keyword_multi ("protocol" , &ble_elist_protocol_handler, &snprint_ble_simple);install_keyword_multi ("device" , &ble_except_device_handler,NULL );install_sublevel ();install_keyword ("vendor" , &ble_elist_device_vendor_handler, &snprint_bled_vendor);
libmultipath/discovery.c +3 -2
@@ -1887,9 +1887,10 @@ int pathinfo(struct path *pp, struct config *conf, int mask)if (mask &DI_BLACKLIST && mask &DI_SYSFS ) {if (filter_device (conf->blist_device, conf->elist_device, - pp->vendor_id, pp->product_id) >0 ) { + pp->vendor_id, pp->product_id) >0 || +filter_protocol (conf->blist_protocol, conf->elist_protocol, + pp) >0 )return PATHINFO_SKIPPED ; - } } path_state =path_offline (pp);
libmultipath/print.c +31 -0
@@ -1688,6 +1688,19 @@ int snprint_blacklist_report(struct config *conf, char *buff, int len)if ((len - fwd - threshold) <=0 )return len; + fwd +=snprintf (buff + fwd, len - fwd,"protocol rules:\n" +"- blacklist:\n" ); +if (!snprint_blacklist_group (buff, len, &fwd, &conf->blist_protocol)) +return len; + +if ((len - fwd - threshold) <=0 ) +return len; + fwd +=snprintf (buff + fwd, len - fwd,"- exceptions:\n" ); +if (snprint_blacklist_group (buff, len, &fwd, &conf->elist_protocol) ==0 ) +return len; + +if ((len - fwd - threshold) <=0 ) +return len; fwd +=snprintf (buff + fwd, len - fwd,"wwid rules:\n" "- blacklist:\n" );if (snprint_blacklist_group (buff, len, &fwd, &conf->blist_wwid) ==0 )
@@ -1761,6 +1774,15 @@ static int snprint_blacklist(const struct config *conf, char *buff, int len)if (fwd >= len)return len; } + vector_foreach_slot (conf->blist_protocol, ble, i) { + kw =find_keyword (conf->keywords, rootkw->sub,"protocol" ); +if (!kw) +return 0 ; + fwd +=snprint_keyword (buff + fwd, len - fwd,"\t%k %v\n" , + kw, ble); +if (fwd >= len) +return len; + } rootkw =find_keyword (conf->keywords, rootkw->sub,"device" );if (!rootkw)return 0 ;
@@ -1838,6 +1860,15 @@ static int snprint_blacklist_except(const struct config *conf,if (fwd >= len)return len; } + vector_foreach_slot (conf->elist_protocol, ele, i) { + kw =find_keyword (conf->keywords, rootkw->sub,"protocol" ); +if (!kw) +return 0 ; + fwd +=snprint_keyword (buff + fwd, len - fwd,"\t%k %v\n" , + kw, ele); +if (fwd >= len) +return len; + } rootkw =find_keyword (conf->keywords, rootkw->sub,"device" );if (!rootkw)return 0 ;
multipath/multipath.conf.5 +14 -2
@@ -1205,9 +1205,21 @@ The default \fIblacklist exception\fR is: \fB(SCSI_IDENT_|ID_WWN)\fR, causing well-behaved SCSI devices and devices that provide a WWN (World Wide Number) to be included, and all others to be excluded. .RE +.TP +.B protocol +Regular expression for the protocol of a device to be excluded/included. +.RS +.PP +The protocol strings that multipath recognizes are \fIscsi:fcp\fR, +\fIscsi:spi\fR, \fIscsi:ssa\fR, \fIscsi:sbp\fR, \fIscsi:srp\fR, +\fIscsi:iscsi\fR, \fIscsi:sas\fR, \fIscsi:adt\fR, \fIscsi:ata\fR, +\fIscsi:unspec\fR, \fIccw\fR, \fIcciss\fR, \fInvme\fR, and \fIundef\fR. +The protocol that a path is using can be viewed by running +\fBmultipathd show paths format "%d %P"\fR +.RE .LP -For every device, these 4 blacklist criteria are evaluated in the the order -"property, dev\%node, device, wwid". If a device turns out to be +For every device, these 5 blacklist criteria are evaluated in the the order +"property, dev\%node, device, protocol, wwid". If a device turns out to be blacklisted by any criterion, it's excluded from handling by multipathd, and the later criteria aren't evaluated any more. For each criterion, the whitelist takes precedence over the blacklist if a device
Signature · 1 line
2.7.4
Re: [PATCH 07/10] libmultipath: add "protocol" blacklist option.
Quoted 18 lines · Benjamin Marzinski
Multiple users have requested an easy way to setup blacklists that do things such as blacklisting all non FC and iSCSI devices. Currently there is no easy way to do this, without knowing in advance what the devices are. Looking into the udev property values, I didn't see a consistent set of values that would worked for all the different types
of requests like this (which would have allowed us to solve this by extending the "property" blacklist option to allow comparing values, instead of just keywords).Instead I've opted to allow multipath to blacklist/whitelist devices by the protocol strings printed by "multipathd: add new protocol path wildcard". This check happens after multipath checks the "device" keyword, and before it checks wwid. This gives users an easily understandible method to set up these types of blacklists, without needing to know the exact arrays being used.
Signed-off-by Benjamin Marzinski <[email protected]>
Quoted 11 lines
--- libmultipath/blacklist.c | 51 ++++++++++++++++++++++++++++++++++++++-------- libmultipath/blacklist.h | 3 +++ libmultipath/config.c | 15 ++++++++++++++ libmultipath/config.h | 2 ++ libmultipath/dict.c | 14 +++++++++++-- libmultipath/discovery.c | 5 +++-- libmultipath/print.c | 31 ++++++++++++++++++++++++++++ multipath/multipath.conf.5 | 16 +++++++++++++-- 8 files changed, 123 insertions(+), 14 deletions(-)
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH 8/10 libmultipath: remove _filter_* blacklist functions
In reply to Benjamin MarzinskiThe one point of these functions was for _filter_path(), and that wasn't improved by using them. Since filter_path() only printed one message at the end, you could have situations where the wwid was blacklisted, but the blacklist message included the vendor/product instead. Also, the protocol and property messages were printed twice, and if the device was on multiple whitelists, only the last one is printed.
--- libmultipath/blacklist.c | 168 +++++++++++++++++++---------------------------- libmultipath/blacklist.h | 2 +- libmultipath/configure.c | 2 +- libmultipath/discovery.c | 2 +- 4 files changed, 71 insertions(+), 103 deletions(-)
libmultipath/blacklist.c +68 -100
@@ -294,161 +294,129 @@ log_filter (const char *dev, char *vendor, char *product, char *wwid, }int -_filter_device (vector blist,vector elist,char * vendor,char * product) +filter_device (vector blist,vector elist,char * vendor,char * product, +char * dev) { -if (!vendor || !product) -return 0 ; -if (_blacklist_exceptions_device (elist, vendor, product)) -return MATCH_DEVICE_BLIST_EXCEPT ; -if (_blacklist_device (blist, vendor, product)) -return MATCH_DEVICE_BLIST ; -return 0 ; -} +int r =MATCH_NOTHING ; -int -filter_device (vector blist,vector elist,char * vendor,char * product) -{ -int r =_filter_device (blist, elist, vendor, product); -log_filter (NULL , vendor, product,NULL ,NULL ,NULL , r); -return r; -} +if (vendor && product) { +if (_blacklist_exceptions_device (elist, vendor, product)) + r =MATCH_DEVICE_BLIST_EXCEPT ; +else if (_blacklist_device (blist, vendor, product)) + r =MATCH_DEVICE_BLIST ; + } -int -_filter_devnode (vector blist,vector elist,char * dev) -{ -if (!dev) -return 0 ; -if (_blacklist_exceptions (elist, dev)) -return MATCH_DEVNODE_BLIST_EXCEPT ; -if (_blacklist (blist, dev)) -return MATCH_DEVNODE_BLIST ; -return 0 ; +log_filter (dev, vendor, product,NULL ,NULL ,NULL , r); +return r; }int filter_devnode (vector blist,vector elist,char * dev) { -int r =_filter_devnode (blist, elist, dev); +int r =MATCH_NOTHING ; + +if (dev) { +if (_blacklist_exceptions (elist, dev)) + r =MATCH_DEVNODE_BLIST_EXCEPT ; +else if (_blacklist (blist, dev)) + r =MATCH_DEVNODE_BLIST ; + } +log_filter (dev,NULL ,NULL ,NULL ,NULL ,NULL , r);return r; }int -_filter_wwid (vector blist,vector elist,char * wwid) -{ -if (!wwid) -return 0 ; -if (_blacklist_exceptions (elist, wwid)) -return MATCH_WWID_BLIST_EXCEPT ; -if (_blacklist (blist, wwid)) -return MATCH_WWID_BLIST ; -return 0 ; -} - -int filter_wwid (vector blist,vector elist,char * wwid,char * dev) { -int r =_filter_wwid (blist, elist, wwid); +int r =MATCH_NOTHING ; + +if (wwid) { +if (_blacklist_exceptions (elist, wwid)) + r =MATCH_WWID_BLIST_EXCEPT ; +else if (_blacklist (blist, wwid)) + r =MATCH_WWID_BLIST ; + } +log_filter (dev,NULL ,NULL , wwid,NULL ,NULL , r);return r; } -static int -_filter_protocol (vector blist,vector elist,const char * protocol_str) -{ -if (_blacklist_exceptions (elist, protocol_str)) -return MATCH_PROTOCOL_BLIST_EXCEPT ; -if (_blacklist (blist, protocol_str)) -return MATCH_PROTOCOL_BLIST ; -return 0 ; -} -int filter_protocol (vector blist,vector elist,struct path * pp) {char buf[PROTOCOL_BUF_SIZE ]; -int r; +int r =MATCH_NOTHING ; + +if (pp) { +snprint_path_protocol (buf,sizeof (buf), pp); + +if (_blacklist_exceptions (elist, buf)) + r =MATCH_PROTOCOL_BLIST_EXCEPT ; +else if (_blacklist (blist, buf)) + r =MATCH_PROTOCOL_BLIST ; + } -snprint_path_protocol (buf,sizeof (buf), pp); - r =_filter_protocol (blist, elist, buf);log_filter (pp->dev,NULL ,NULL ,NULL ,NULL , buf, r);return r; }int -_filter_path (struct config * conf,struct path * pp) +filter_path (struct config * conf,struct path * pp) {int r; r =filter_property (conf, pp->udev);if (r >0 )return r; - r =_filter_devnode (conf->blist_devnode, conf->elist_devnode,pp->dev); + r =filter_devnode (conf->blist_devnode, conf->elist_devnode, pp->dev);if (r >0 )return r; - r =_filter_device (conf->blist_device, conf->elist_device, - pp->vendor_id, pp->product_id); + r =filter_device (conf->blist_device, conf->elist_device, + pp->vendor_id, pp->product_id, pp->dev);if (r >0 )return r; r =filter_protocol (conf->blist_protocol, conf->elist_protocol, pp);if (r >0 )return r; - r =_filter_wwid (conf->blist_wwid, conf->elist_wwid, pp->wwid); + r =filter_wwid (conf->blist_wwid, conf->elist_wwid, pp->wwid, pp->dev);return r; }int -filter_path (struct config * conf,struct path * pp) -{ -int r=_filter_path (conf, pp); -log_filter (pp->dev, pp->vendor_id, pp->product_id, pp->wwid,NULL , -NULL , r); -return r; -} - -int -_filter_property (struct config *conf,const char *env) -{ -if (_blacklist_exceptions (conf->elist_property, env)) -return MATCH_PROPERTY_BLIST_EXCEPT ; -if (_blacklist (conf->blist_property, env)) -return MATCH_PROPERTY_BLIST ; - -return 0 ; -} - -int filter_property (struct config * conf,struct udev_device * udev) {const char *devname =udev_device_get_sysname (udev);struct udev_list_entry *list_entry; -int r; - -if (!udev) -return 0 ; - -udev_list_entry_foreach (list_entry, +const char *env =NULL ; +int r =MATCH_NOTHING ; + +if (udev) { +/* +* This is the inverse of the 'normal' matching; +* the environment variable _has_ to match. +*/ + r =MATCH_PROPERTY_BLIST_MISSING ; +udev_list_entry_foreach (list_entry, udev_device_get_properties_list_entry(udev)) { -const char *env; - - env =udev_list_entry_get_name (list_entry); -if (!env) -continue ; - r =_filter_property (conf, env); -if (r) { -log_filter (devname,NULL ,NULL ,NULL , env,NULL , r); -return r; + env =udev_list_entry_get_name (list_entry); +if (!env) +continue ; +if (_blacklist_exceptions (conf->elist_property, env)) { + r =MATCH_PROPERTY_BLIST_EXCEPT ; +break ; + } +if (_blacklist (conf->blist_property, env)) { + r =MATCH_PROPERTY_BLIST ; +break ; + } + env =NULL ; } } -/* -* This is the inverse of the 'normal' matching; -* the environment variable _has_ to match. -*/ -log_filter (devname,NULL ,NULL ,NULL ,NULL ,NULL , -MATCH_PROPERTY_BLIST_MISSING ); -return MATCH_PROPERTY_BLIST_MISSING ; +log_filter (devname,NULL ,NULL ,NULL , env,NULL , r); +return r; }static void free_ble (struct blentry *ble)
libmultipath/blacklist.h +1 -1
@@ -35,7 +35,7 @@ int setup_default_blist (struct config *);int alloc_ble_device (vector );int filter_devnode (vector ,vector ,char *);int filter_wwid (vector ,vector ,char *,char *); -int filter_device (vector ,vector ,char *,char *); +int filter_device (vector ,vector ,char *,char *,char *);int filter_path (struct config *,struct path *);int filter_property (struct config *,struct udev_device *);int filter_protocol (vector ,vector ,struct path *);
libmultipath/configure.c +1 -1
@@ -1030,7 +1030,7 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, invalid =1 ;pthread_cleanup_pop (1 );if (invalid) { -orphan_path (pp1,"wwid blacklisted" ); +orphan_path (pp1,"blacklisted" );continue ; }
libmultipath/discovery.c +1 -1
@@ -1887,7 +1887,7 @@ int pathinfo(struct path *pp, struct config *conf, int mask)if (mask &DI_BLACKLIST && mask &DI_SYSFS ) {if (filter_device (conf->blist_device, conf->elist_device, - pp->vendor_id, pp->product_id) >0 || + pp->vendor_id, pp->product_id, pp->dev) >0 ||filter_protocol (conf->blist_protocol, conf->elist_protocol, pp) >0 )return PATHINFO_SKIPPED ;
Signature · 1 line
2.7.4
Re: [PATCH 08/10] libmultipath: remove _filter_* blacklist functions
Quoted 11 lines · Benjamin Marzinski
The one point of these functions was for
_filter_path(), and that wasn't
improved by using them. Sincefilter_path()only printed one message at
the end, you could have situations where the wwid was blacklisted, but
the blacklist message included the vendor/product instead. Also, the protocol and property messages were printed twice, and if the device was
on multiple whitelists, only the last one is printed.
Quoted 8 lines
Signed-off-by Benjamin Marzinski <[email protected]>--- libmultipath/blacklist.c | 168 +++++++++++++++++++---------------- ------------ libmultipath/blacklist.h | 2 +- libmultipath/configure.c | 2 +- libmultipath/discovery.c | 2 +- 4 files changed, 71 insertions(+), 103 deletions(-)
One remark:
libmultipath/blacklist.c log_filter (const char *dev, char *vendor, char *product, char *wwid, · line 298
Quoted 3 lines
+filter_device (vector blist, vector elist, char * vendor, char * product,
libmultipath/blacklist.c +1
-0+ char * dev)
While we are at it, could we further simplify these to take a "conf" argument instead of elist and blist?
Martin
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH 9/10 multipath tests: change to work with old make versions
In reply to Benjamin Marzinskithe $(file <) operation only works with make 4.2 and above. I tried running the tests on an old machine and it failed. The $shell function can do the same thing and multipath has been using that in its Makefiles for a while.
--- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/Makefile +1 -1
@@ -51,4 +51,4 @@ COLON:=: $(multipathdir)/libmultipath.so Makefile $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $< $($@_TESTDEPS) $($@_OBJDEPS) \ $(LIBDEPS) $($@_LIBDEPS) \ - $(file <$<.wrap) $(foreach dep,$($@_TESTDEPS),$(file <$(dep).wrap)) + $(shell cat $<.wrap) $(foreach dep,$($@_TESTDEPS),$(shell cat $(dep).wrap))
Signature · 1 line
2.7.4
Re: [PATCH 09/10] multipath tests: change to work with old make versions
Quoted 11 lines · Benjamin Marzinski
the $(file <) operation only works with make 4.2 and above. I tried running the tests on an old machine and it failed. The $shell function
can do the same thing and multipath has been using that in its Makefiles for a while.Signed-off-by Benjamin Marzinski <[email protected]>--- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
I guess I'm lucky that your old make grok'd the magic in 0820bd24df ;-)
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH 10/10 multipath tests: add blacklist tests
In reply to Benjamin MarzinskiThese are tests to validate the filter_* blacklist functions. They not only verify that the device is correctly blacklisted/whitelisted, but they also verify the log messages that are printed out.
--- tests/Makefile | 4 +- tests/blacklist.c | 512 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 515 insertions(+), 1 deletion(-) create mode 100644 tests/blacklist.c
tests/Makefile +3 -1
@@ -3,7 +3,7 @@ include ../Makefile.inc CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathcmddir) LIBDEPS += -L$(multipathdir) -lmultipath -lcmocka -TESTS := uevent parser util dmevents hwtable +TESTS := uevent parser util dmevents hwtable blacklist .SILENT: $(TESTS:%=%.o) .PRECIOUS: $(TESTS:%=%-test)
@@ -23,6 +23,8 @@ hwtable-test_TESTDEPS := test-lib.o hwtable-test_OBJDEPS := ../libmultipath/discovery.o ../libmultipath/blacklist.o \ ../libmultipath/prio.o ../libmultipath/callout.o ../libmultipath/structs.o hwtable-test_LIBDEPS := -ludev -lpthread -ldl +blacklist-test_OBJDEPS := ../libmultipath/blacklist.o +blacklist-test_LIBDEPS := -ludev %.out: %-test @echo == running $< ==
tests/blacklist.c new file +512 -0
512 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH 10/10] multipath tests: add blacklist tests
Quoted 5 lines · Benjamin Marzinski
These are tests to validate the filter_* blacklist functions. They not
only verify that the device is correctly blacklisted/whitelisted, but they also verify the log messages that are printed out.
Quoted 7 lines
Signed-off-by Benjamin Marzinski <[email protected]>--- tests/Makefile | 4 +- tests/blacklist.c | 512 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 515 insertions(+), 1 deletion(-) create mode 100644 tests/blacklist.c
__wrap_dlog() / expect_condlog() are brilliant, maybe we should put them in test-lib.c.
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel