How to fix system stall on root volume multipath
Subsystems (2)
Hi,
If we use multipath for "/", temporal all-paths failure could lead to system stall because multipathd depends on callout programs on "/". I would like to hear your comments about my idea to fix it.
For example, the script below causes system stall on the following environmnt.
o "/" on a multipath device
o setting 'no_path_retry = queue'
o using priority callout (If your storage doesn't have priority callout, using "/bin/echo 1" should be fine for testing.)
-----------------------------------------------------------------
#!/bin/sh
# specify all paths for your root filesystem paths="sdd sdg"
while true; do
for dev in $paths; do
echo offline > /sys/block/${dev}/device/state
done
for dev in $paths; do
echo running > /sys/block/${dev}/device/state
donedone
-----------------------------------------------------------------
This is because the path checker thread stalls on executing the priority callout and revived paths aren't reinstated.
To fix it, my proposal is to build all priority callouts into multipathd as library functions like path checkers.
(But keep the feature to use external priority callouts as an option.)
Although the proposal doesn't work if target device for down/up path is deleted/added because getuid callouts are used for path addition, the target device deletion can be controlled by the "dev_loss_tmo" parameter of transport layer.
Also, source codes of getuid callouts are outside of multipath-tools. So I think making only all priority callouts built-in is enough now.
Ideally, multipathd shouldn't do file I/Os nor get memory after started. I think the proposal above is the first step for the ideal multipathd. What do you think about it?
Thanks,
Kiyoshi Ueda
Alasdair G Kergon
maintainerQuoted 3 lines · Kiyoshi Ueda
If we use multipath for "/", temporal all-paths failure could lead to system stall because multipathd depends on callout programs on "/". I would like to hear your comments about my idea to fix it.
I thought it avoided that problem by pre-loading everything into a ramdisk:
did that code get dropped for some reason?
Alasdair
Signature · 1 line
[email protected]
Hi Alasdair,
Quoted 7 lines · Alasdair G Kergon
Quoted 3 lines · Kiyoshi Ueda
If we use multipath for "/", temporal all-paths failure could lead to system stall because multipathd depends on callout programs on "/". I would like to hear your comments about my idea to fix it.
I thought it avoided that problem by pre-loading everything into a ramdisk:
did that code get dropped for some reason?
Thank you for the information! I had forgotten it!
Yes, we used to have it, and it seems to be removed by the commit below:
http://git.kernel.org/gitweb.cgi?p=linux/storage/multipath-tools/.git;a=commitdiff;h=cad20ecf8919b2126ab6f4f793a1a738e9864f59
And probably the following thread is related to the commit.
https://www.redhat.com/archives/dm-devel/2005-July/msg00044.html
Ben, Christophe,
Is that code still problem for current multipathd? And what do you think about my proposal?
Thanks,
Kiyoshi Ueda
Quoted 15 lines · Kiyoshi Ueda
Hi Alasdair,
Quoted 7 lines · Alasdair G Kergon
Quoted 3 lines · Kiyoshi Ueda
If we use multipath for "/", temporal all-paths failure could lead to system stall because multipathd depends on callout programs on "/". I would like to hear your comments about my idea to fix it.
I thought it avoided that problem by pre-loading everything into a ramdisk:
did that code get dropped for some reason?Thank you for the information! I had forgotten it!
Yes, we used to have it, and it seems to be removed by the commit below:http://git.kernel.org/gitweb.cgi?p=linux/storage/multipath-tools/.git;a=commitdiff;h=cad20ecf8919b2126ab6f4f793a1a738e9864f59
Quoted 8 lines
And probably the following thread is related to the commit.
https://www.redhat.com/archives/dm-devel/2005-July/msg00044.htmlBen, Christophe,
Is that code still problem for current multipathd? And what do you think about my proposal?
I'm not found of yet-another user-visible ramfs for multipathd use, that's why I started with the private namespace tricks. The problems are still there, and will stay till we stop using pthreads.
That may happen someday, as one of the main reason for pthread was the (blocking ioctl) libdevmapper event collection. And this is being superseded by path status uevents.
But not soon enough, and the private namespace stuff suffers from lack of friendliness anyway : we can't expect users to grasp easily that changing their prioritizer in /sbin won't be seen by the multipath daemon till restart, for example.
So I propose to start playing with your prioritizers-as-lib idea to see if it's practical.
I prepared the following patch to that effect. It is not complete (actually segfaults, no useful prioritizer ported) but can start fixing bugs and go where ever your personnal interest leads.
Looking forward to your fixes,
Thanks,
cvaroqui
Makefile.inc +2 -0
@@ -24,6 +24,7 @@ exec_prefix = $(prefix) bindir = $(exec_prefix)/sbin libudevdir = ${prefix}/lib/udev checkersdir = $(TOPDIR)/libcheckers +libpriodir = $(TOPDIR)/libprio multipathdir = $(TOPDIR)/libmultipath mandir = $(prefix)/usr/share/man/man8 man5dir = $(prefix)/usr/share/man/man5
@@ -33,6 +34,7 @@ GZIP = /bin/gzip -9 -c CHECKERSLIB = $(checkersdir)/libcheckers MULTIPATHLIB = $(multipathdir)/libmultipath +LIBPRIO = $(libpriodir)/libprio INSTALL_PROGRAM = install -s
libmultipath/Makefile +1 -1
@@ -6,7 +6,7 @@ BUILD = glibc include ../Makefile.inc -CFLAGS += -I$(checkersdir) +CFLAGS += -I$(checkersdir) -I$(libpriodir) OBJS = memory.o parser.o vector.o devmapper.o callout.o \ hwtable.o blacklist.o util.o dmparser.o config.o \
libmultipath/config.c +1 -9
@@ -135,9 +135,6 @@ free_hwe (struct hwentry * hwe)if (hwe->getuid)FREE (hwe->getuid); -if (hwe->getprio) -FREE (hwe->getprio); -if (hwe->features)FREE (hwe->features);
@@ -265,9 +262,6 @@ store_hwe (vector hwtable, struct hwentry * dhwe)if (dhwe->getuid && !(hwe->getuid =set_param_str (dhwe->getuid))) goto out; -if (dhwe->getprio && !(hwe->getprio =set_param_str (dhwe->getprio))) - goto out; -if (dhwe->features && !(hwe->features =set_param_str (dhwe->features))) goto out;
@@ -283,6 +277,7 @@ store_hwe (vector hwtable, struct hwentry * dhwe) hwe->no_path_retry = dhwe->no_path_retry; hwe->minio = dhwe->minio; hwe->checker = dhwe->checker; + hwe->prio = dhwe->prio;if (dhwe->bl_product && !(hwe->bl_product =set_param_str (dhwe->bl_product))) goto out;
@@ -321,9 +316,6 @@ free_config (struct config * conf)if (conf->getuid)FREE (conf->getuid); -if (conf->getprio) -FREE (conf->getprio); -if (conf->features)FREE (conf->features);
libmultipath/config.h +3 -2
@@ -16,11 +16,11 @@ struct hwentry {char * product;char * revision;char * getuid; -char * getprio;char * features;char * hwhandler;char * selector;char * checker_name; +char * prio_name;int pgpolicy;int pgfailback;
@@ -28,6 +28,7 @@ struct hwentry {int no_path_retry;int minio;int pg_timeout; +struct prio * prio;struct checker * checker;char * bl_product; };
@@ -53,6 +54,7 @@ struct config {int pgpolicy_flag;int with_sysfs;int pgpolicy; +struct prio * prio;struct checker * checker;enum devtypes dev_type;int minio;
@@ -70,7 +72,6 @@ struct config {char * udev_dir;char * selector;char * getuid; -char * getprio;char * features;char * hwhandler;char * bindings_file;
libmultipath/defaults.h +0 -1
@@ -4,7 +4,6 @@#define DEFAULT_FEATURES "0"#define DEFAULT_HWHANDLER "0"#define DEFAULT_MINIO 1000 -#define DEFAULT_GETPRIO NULL#define DEFAULT_PGPOLICY FAILOVER#define DEFAULT_FAILBACK -FAILBACK_MANUAL#define DEFAULT_RR_WEIGHT RR_WEIGHT_NONE
libmultipath/dict.c +28 -38
132 lines not on this page · raw message
libmultipath/discovery.c +9 -19
@@ -12,6 +12,7 @@#include <errno.h> #include <checkers.h> +#include <libprio.h> #include "vector.h" #include "memory.h"
@@ -626,27 +627,16 @@ get_state (struct path * pp)static int get_prio (struct path * pp) { -char buff[CALLOUT_MAX_SIZE ]; -char prio[16 ]; - -if (!pp->getprio_selected) { -select_getprio (pp); - pp->getprio_selected =1 ; - } -if (!pp->getprio) { - pp->priority =PRIO_DEFAULT ; - }else if (apply_format (pp->getprio, &buff[0 ], pp)) { -condlog (0 ,"error formatting prio callout command" ); - pp->priority =PRIO_UNDEF ; -return 1 ; - }else if (execute_program (buff, prio,16 )) { -condlog (0 ,"error calling out %s" , buff); +if (!prio_selected (pp->prio)) +select_prio (pp); + pp->priority =prio_getprio (pp->prio, pp); +if (pp->priority <0 ) { +condlog (0 ,"%s: %s prio error" , pp->dev,prio_name (pp->prio)); pp->priority =PRIO_UNDEF ;return 1 ; - }else - pp->priority =atoi (prio); - -condlog (3 ,"%s: prio = %u" , pp->dev, pp->priority); + } +condlog (3 ,"%s: %s prio = %u" , + pp->dev,prio_name (pp->prio), pp->priority);return 0 ; }
libmultipath/hwtable.c +44 -43
507 lines not on this page · raw message
libmultipath/propsel.c +13 -11
@@ -6,6 +6,7 @@#include <stdio.h> #include <checkers.h> +#include <libprio.h> #include "memory.h" #include "vector.h"
@@ -257,22 +258,23 @@ select_getuid (struct path * pp) }extern int -select_getprio (struct path * pp) +select_prio (struct path * pp) { -if (pp->hwe && pp->hwe->getprio) { - pp->getprio = pp->hwe->getprio; -condlog (3 ,"%s: getprio = %s (controller setting)" , - pp->dev, pp->getprio); +if (pp->hwe && pp->hwe->prio) { + pp->prio = pp->hwe->prio; +condlog (3 ,"%s: prio = %s (controller setting)" , + pp->dev,prio_name (pp->prio));return 0 ; } -if (conf->getprio) { - pp->getprio = conf->getprio; -condlog (3 ,"%s: getprio = %s (config file default)" , - pp->dev, pp->getprio); +if (conf->prio) { + pp->prio = conf->prio; +condlog (3 ,"%s: prio = %s (config file default)" , + pp->dev,prio_name (pp->prio));return 0 ; } - pp->getprio =DEFAULT_GETPRIO ; -condlog (3 ,"%s: getprio = NULL (internal default)" , pp->dev); + pp->prio =prio_default (); +condlog (3 ,"%s: prio = %s (internal default)" , + pp->dev,prio_name (pp->prio));return 0 ; }
libmultipath/propsel.h +1 -1
@@ -7,7 +7,7 @@ int select_features (struct multipath * mp);int select_hwhandler (struct multipath * mp);int select_checker (struct path *pp);int select_getuid (struct path * pp); -int select_getprio (struct path * pp); +int select_prio (struct path * pp);int select_no_path_retry (struct multipath *mp);int select_pg_timeout (struct multipath *mp);int select_minio (struct multipath *mp);
libmultipath/structs.h +1 -2
@@ -121,8 +121,7 @@ struct path {int priority;int pgindex;char * getuid; -char * getprio; -int getprio_selected; +struct prio * prio;struct checker checker;struct multipath * mpp;int fd;
libmultipath/structs_vec.c +2 -2
@@ -3,6 +3,7 @@#include <unistd.h> #include <checkers.h> +#include <libprio.h> #include "vector.h" #include "defaults.h"
@@ -81,8 +82,7 @@ orphan_path (struct path * pp) pp->mpp =NULL ; pp->dmstate =PSTATE_UNDEF ; pp->getuid =NULL ; - pp->getprio =NULL ; - pp->getprio_selected =0 ; +prio_put (pp->prio);checker_put (&pp->checker);if (pp->fd >=0 )close (pp->fd);
multipath.conf.annotated +7 -8
@@ -52,14 +52,14 @@ # getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n" # # # -# # name : prio_callout +# # name : prio # # scope : multipath -# # desc : the default program and args to callout to obtain a path +# # desc : the default function to call to obtain a path # # priority value. The ALUA bits in SPC-3 provide an -# # exploitable prio value for example. "none" is a valid value +# # exploitable prio value for example. # # default : (null) # # -# #prio_callout "/bin/true" +# #prio "alua" # # # # # name : path_checker
@@ -296,15 +296,14 @@ # getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n" # # # -# # name : prio_callout +# # name : prio # # scope : multipath -# # desc : the program and args to callout to obtain a path +# # desc : the function to call to obtain a path # # weight. Weights are summed for each path group to # # determine the next PG to use case of failure. -# # "none" is a valid value. # # default : no callout, all paths equals # # -# prio_callout "/sbin/mpath_prio_balance_units %d" +# prio "hp_sw" # # # # # name : path_checker
multipath.conf.synthetic +1 -1
@@ -8,7 +8,7 @@ # selector "round-robin 0" # path_grouping_policy multibus # getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n" -# prio_callout /bin/true +# prio const # path_checker directio # rr_min_io 100 # rr_weight priorities
multipathd/Makefile +4 -0
@@ -21,6 +21,7 @@ LDFLAGS = -lpthread -ldevmapper -lreadline -lncurses -laio # OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o \ $(MULTIPATHLIB)-glibc.a $(CHECKERSLIB)-glibc.a \ + $(LIBPRIO)-glibc.a #
@@ -37,6 +38,9 @@ $(EXEC): clean $(OBJS) $(CC) $(OBJS) -o $(EXEC) $(LDFLAGS) $(GZIP) $(EXEC).8 > $(EXEC).8.gz +$(LIBPRIO)-glibc.a: + $(MAKE) -C $(libpriodir) BUILD=glibc glibc + $(CHECKERSLIB)-glibc.a: $(MAKE) -C $(checkersdir) BUILD=glibc glibc
Hi Christophe,
Quoted 37 lines · Christophe Varoqui
Le lundi 12 novembre 2007 11:24 -0500, Kiyoshi Ueda a crit :
Quoted 15 lines
Hi Alasdair,
Quoted 7 lines · Alasdair G Kergon
Quoted 3 lines · Kiyoshi Ueda
If we use multipath for "/", temporal all-paths failure could lead to system stall because multipathd depends on callout programs on "/". I would like to hear your comments about my idea to fix it.
I thought it avoided that problem by pre-loading everything into a ramdisk:
did that code get dropped for some reason?Thank you for the information! I had forgotten it!
Yes, we used to have it, and it seems to be removed by the commit below:http://git.kernel.org/gitweb.cgi?p=linux/storage/multipath-tools/.git;a=commitdiff;h=cad20ecf8919b2126ab6f4f793a1a738e9864f59Quoted 7 lines
And probably the following thread is related to the commit.
https://www.redhat.com/archives/dm-devel/2005-July/msg00044.htmlBen, Christophe,
Is that code still problem for current multipathd? And what do you think about my proposal?I'm not found of yet-another user-visible ramfs for multipathd use, that's why I started with the private namespace tricks. The problems are still there, and will stay till we stop using pthreads.
That may happen someday, as one of the main reason for pthread was the (blocking ioctl) libdevmapper event collection. And this is being superseded by path status uevents.
But not soon enough, and the private namespace stuff suffers from lack of friendliness anyway : we can't expect users to grasp easily that changing their prioritizer in /sbin won't be seen by the multipath daemon till restart, for example.
Quoted 6 lines
So I propose to start playing with your prioritizers-as-lib idea to see if it's practical.
I prepared the following patch to that effect. It is not complete (actually segfaults, no useful prioritizer ported) but can start fixing bugs and go where ever your personnal interest leads.
Thank you for the patch.
OK, I'll try the implementation.
Thanks,
Kiyoshi Ueda
Benjamin Marzinski
maintainerQuoted 21 lines · Christophe Varoqui
Quoted 19 lines · Kiyoshi Ueda
Hi Alasdair,
Quoted 7 lines · Alasdair G Kergon
Quoted 3 lines · Kiyoshi Ueda
If we use multipath for "/", temporal all-paths failure could lead to system stall because multipathd depends on callout programs on "/". I would like to hear your comments about my idea to fix it.
I thought it avoided that problem by pre-loading everything into a ramdisk:
did that code get dropped for some reason?Thank you for the information! I had forgotten it!
Yes, we used to have it, and it seems to be removed by the commit below:http://git.kernel.org/gitweb.cgi?p=linux/storage/multipath-tools/.git;a=commitdiff;h=cad20ecf8919b2126ab6f4f793a1a738e9864f59And probably the following thread is related to the commit.
https://www.redhat.com/archives/dm-devel/2005-July/msg00044.html
Quoted 7 lines
Quoted 4 lines
Ben, Christophe,
Is that code still problem for current multipathd? And what do you think about my proposal?I'm not found of yet-another user-visible ramfs for multipathd use, that's why I started with the private namespace tricks. The problems are still there, and will stay till we stop using pthreads.
The original problem that I found wasn't a design issue, it was that pthreads were not working to correctly. When I try the pthread test program that I posted in
https://www.redhat.com/archives/dm-devel/2005-July/msg00044.html
on RHEL 5, the problem seems to be fixed.
-Ben
Quoted 1,076 lines
That may happen someday, as one of the main reason for pthread was the (blocking ioctl) libdevmapper event collection. And this is being superseded by path status uevents.
But not soon enough, and the private namespace stuff suffers from lack of friendliness anyway : we can't expect users to grasp easily that changing their prioritizer in /sbin won't be seen by the multipath daemon till restart, for example.
So I propose to start playing with your prioritizers-as-lib idea to see if it's practical.
I prepared the following patch to that effect. It is not complete (actually segfaults, no useful prioritizer ported) but can start fixing bugs and go where ever your personnal interest leads.
Looking forward to your fixes,
Thanks,
cvaroquiMakefile.inc +2
-0@@ -24,6 +24,7 @@ exec_prefix = $(prefix) bindir = $(exec_prefix)/sbin libudevdir = ${prefix}/lib/udev checkersdir = $(TOPDIR)/libcheckers +libpriodir = $(TOPDIR)/libprio multipathdir = $(TOPDIR)/libmultipath mandir = $(prefix)/usr/share/man/man8 man5dir = $(prefix)/usr/share/man/man5@@ -33,6 +34,7 @@ GZIP = /bin/gzip -9 -c CHECKERSLIB = $(checkersdir)/libcheckers MULTIPATHLIB = $(multipathdir)/libmultipath +LIBPRIO = $(libpriodir)/libprio INSTALL_PROGRAM = install -slibmultipath/Makefile +1
-1@@ -6,7 +6,7 @@ BUILD = glibc include ../Makefile.inc -CFLAGS += -I$(checkersdir) +CFLAGS += -I$(checkersdir) -I$(libpriodir) OBJS = memory.o parser.o vector.o devmapper.o callout.o \ hwtable.o blacklist.o util.o dmparser.o config.o \libmultipath/config.c +1
-9@@ -135,9 +135,6 @@ free_hwe (struct hwentry * hwe)if (hwe->getuid)FREE (hwe->getuid); -if (hwe->getprio) -FREE (hwe->getprio); -if (hwe->features)FREE (hwe->features);@@ -265,9 +262,6 @@ store_hwe (vector hwtable, struct hwentry * dhwe)if (dhwe->getuid && !(hwe->getuid =set_param_str (dhwe->getuid))) goto out; -if (dhwe->getprio && !(hwe->getprio =set_param_str (dhwe->getprio))) - goto out; -if (dhwe->features && !(hwe->features =set_param_str (dhwe->features))) goto out;@@ -283,6 +277,7 @@ store_hwe (vector hwtable, struct hwentry * dhwe) hwe->no_path_retry = dhwe->no_path_retry; hwe->minio = dhwe->minio; hwe->checker = dhwe->checker; + hwe->prio = dhwe->prio;if (dhwe->bl_product && !(hwe->bl_product =set_param_str (dhwe->bl_product))) goto out;@@ -321,9 +316,6 @@ free_config (struct config * conf)if (conf->getuid)FREE (conf->getuid); -if (conf->getprio) -FREE (conf->getprio); -if (conf->features)FREE (conf->features);libmultipath/config.h +3
-2@@ -16,11 +16,11 @@ struct hwentry {char * product;char * revision;char * getuid; -char * getprio;char * features;char * hwhandler;char * selector;char * checker_name; +char * prio_name;int pgpolicy;int pgfailback;@@ -28,6 +28,7 @@ struct hwentry {int no_path_retry;int minio;int pg_timeout; +struct prio * prio;struct checker * checker;char * bl_product; };@@ -53,6 +54,7 @@ struct config {int pgpolicy_flag;int with_sysfs;int pgpolicy; +struct prio * prio;struct checker * checker;enum devtypes dev_type;int minio;@@ -70,7 +72,6 @@ struct config {char * udev_dir;char * selector;char * getuid; -char * getprio;char * features;char * hwhandler;char * bindings_file;libmultipath/defaults.h +0
-1@@ -4,7 +4,6 @@#define DEFAULT_FEATURES "0"#define DEFAULT_HWHANDLER "0"#define DEFAULT_MINIO 1000 -#define DEFAULT_GETPRIO NULL#define DEFAULT_PGPOLICY FAILOVER#define DEFAULT_FAILBACK -FAILBACK_MANUAL#define DEFAULT_RR_WEIGHT RR_WEIGHT_NONElibmultipath/dict.c +28
-38@@ -5,6 +5,7 @@* Copyright (c) 2005 Kiyoshi Ueda, NEC */ #include <checkers.h> +#include <libprio.h> #include "vector.h" #include "hwtable.h" @@ -82,19 +83,16 @@ def_getuid_callout_handler(vector strvec) }static int -def_prio_callout_handler (vector strvec) +def_prio_handler (vector strvec) { - conf->getprio =set_value (strvec); +char * buff; -if (!conf->getprio) + buff =set_value (strvec); +if (!buff)return 1 ; - -if (strlen (conf->getprio) ==4 && - !strcmp (conf->getprio,"none" )) { -FREE (conf->getprio); - conf->getprio =NULL ; - } - + + conf->prio =prio_lookup (buff); +FREE (buff);return 0 ; }@@ -571,23 +569,20 @@ hw_handler_handler(vector strvec) }static int -prio_callout_handler (vector strvec) +prio_handler (vector strvec) {struct hwentry * hwe =VECTOR_LAST_SLOT (conf->hwtable); +char * buff;if (!hwe)return 1 ; - hwe->getprio =set_value (strvec); - -if (!hwe->getprio) + buff =set_value (strvec); +if (!buff)return 1 ; - -if (strlen (hwe->getprio) ==4 && !strcmp (hwe->getprio,"none" )) { -FREE (hwe->getprio); - hwe->getprio =NULL ; - } - + + hwe->prio =prio_lookup (buff); +FREE (buff);return 0 ; }@@ -1115,23 +1110,18 @@ snprint_hw_getuid_callout (char * buff, int len, void * data) }static int -snprint_hw_prio_callout (char * buff,int len,void * data) +snprint_hw_prio (char * buff,int len,void * data) {struct hwentry * hwe = (struct hwentry *)data; -if (!conf->getprio && !hwe->getprio) +if (!hwe->prio)return 0 ; -if (!conf->getprio && hwe->getprio) -return snprintf (buff, len,"%s" , hwe->getprio); -if (conf->getprio && !hwe->getprio) -return snprintf (buff, len,"none" ); - -/* conf->getprio && hwe->getprio */ -if (strlen (hwe->getprio) ==strlen (conf->getprio) && - !strcmp (hwe->getprio, conf->getprio)) +if (!prio_selected (hwe->prio))return 0 ; - -return snprintf (buff, len,"%s" , hwe->getprio); +if (hwe->prio == conf->prio) +return 0 ; + +return snprintf (buff, len,"%s" ,prio_name (hwe->prio)); } static int@@ -1364,12 +1354,12 @@ snprint_def_getuid_callout (char * buff, int len, void * data) }static int -snprint_def_getprio_callout (char * buff,int len,void * data) +snprint_def_prio (char * buff,int len,void * data) { -if (!conf->getprio) +if (!conf->prio)return 0 ; -return snprintf (buff, len,"%s" , conf->getprio); +return snprintf (buff, len,"%s" ,prio_name (conf->prio)); } static int@@ -1523,7 +1513,7 @@ init_keywords(void)install_keyword ("selector" , &def_selector_handler, &snprint_def_selector);install_keyword ("path_grouping_policy" , &def_pgpolicy_handler, &snprint_def_path_grouping_policy);install_keyword ("getuid_callout" , &def_getuid_callout_handler, &snprint_def_getuid_callout); -install_keyword ("prio_callout" , &def_prio_callout_handler, &snprint_def_getprio_callout); +install_keyword ("prio" , &def_prio_handler, &snprint_def_prio);install_keyword ("features" , &def_features_handler, &snprint_def_features);install_keyword ("path_checker" , &def_path_checker_handler, &snprint_def_path_checker);install_keyword ("failback" , &default_failback_handler, &snprint_def_failback);@@ -1535,7 +1525,7 @@ init_keywords(void)__deprecated install_keyword ("default_selector" , &def_selector_handler,NULL );__deprecated install_keyword ("default_path_grouping_policy" , &def_pgpolicy_handler,NULL );__deprecated install_keyword ("default_getuid_callout" , &def_getuid_callout_handler,NULL ); -__deprecated install_keyword ("default_prio_callout" , &def_prio_callout_handler,NULL ); +__deprecated install_keyword ("default_prio" , &def_prio_handler,NULL );__deprecated install_keyword ("default_features" , &def_features_handler,NULL );__deprecated install_keyword ("default_path_checker" , &def_path_checker_handler,NULL );@@ -1579,7 +1569,7 @@ init_keywords(void)install_keyword ("path_checker" , &hw_path_checker_handler, &snprint_hw_path_checker);install_keyword ("features" , &hw_features_handler, &snprint_hw_features);install_keyword ("hardware_handler" , &hw_handler_handler, &snprint_hw_hardware_handler); -install_keyword ("prio_callout" , &prio_callout_handler, &snprint_hw_prio_callout); +install_keyword ("prio" , &prio_handler, &snprint_hw_prio);install_keyword ("failback" , &hw_failback_handler, &snprint_hw_failback);install_keyword ("rr_weight" , &hw_weight_handler, &snprint_hw_rr_weight);install_keyword ("no_path_retry" , &hw_no_path_retry_handler, &snprint_hw_no_path_retry);libmultipath/discovery.c +9
-19@@ -12,6 +12,7 @@#include <errno.h> #include <checkers.h> +#include <libprio.h> #include "vector.h" #include "memory.h" @@ -626,27 +627,16 @@ get_state (struct path * pp)static int get_prio (struct path * pp) { -char buff[CALLOUT_MAX_SIZE ]; -char prio[16 ]; - -if (!pp->getprio_selected) { -select_getprio (pp); - pp->getprio_selected =1 ; - } -if (!pp->getprio) { - pp->priority =PRIO_DEFAULT ; - }else if (apply_format (pp->getprio, &buff[0 ], pp)) { -condlog (0 ,"error formatting prio callout command" ); - pp->priority =PRIO_UNDEF ; -return 1 ; - }else if (execute_program (buff, prio,16 )) { -condlog (0 ,"error calling out %s" , buff); +if (!prio_selected (pp->prio)) +select_prio (pp); + pp->priority =prio_getprio (pp->prio, pp); +if (pp->priority <0 ) { +condlog (0 ,"%s: %s prio error" , pp->dev,prio_name (pp->prio)); pp->priority =PRIO_UNDEF ;return 1 ; - }else - pp->priority =atoi (prio); - -condlog (3 ,"%s: prio = %u" , pp->dev, pp->priority); + } +condlog (3 ,"%s: %s prio = %u" , + pp->dev,prio_name (pp->prio), pp->priority);return 0 ; }libmultipath/hwtable.c +44
-43@@ -1,6 +1,7 @@#include <stdio.h> #include <checkers.h> +#include <libprio.h> #include "vector.h" #include "defaults.h" @@ -27,7 +28,6 @@ static struct hwentry default_hw[] = { .vendor = "APPLE*", .product = "Xserve RAID ", .getuid = DEFAULT_GETUID, - .getprio = NULL, .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -37,6 +37,7 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = DEFAULT_CHECKER, + .prio_name = DEFAULT_PRIO, },/* * StorageWorks controller family @@ -48,7 +49,6 @@ static struct hwentry default_hw[] = { .vendor = "3PARdata", .product = "VV", .getuid = DEFAULT_GETUID, - .getprio = NULL, .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -58,12 +58,12 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = DEFAULT_CHECKER, + .prio_name = DEFAULT_PRIO, }, { .vendor = "DEC", .product = "HSG80", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_hp_sw /dev/%n", .features = "1 queue_if_no_path", .hwhandler = "1 hp-sw", .selector = DEFAULT_SELECTOR,@@ -73,12 +73,12 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = HP_SW, + .prio_name = PRIO_HP_SW, }, { .vendor = "HP", .product = "A6189A", .getuid = DEFAULT_GETUID, - .getprio = NULL, .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -87,14 +87,14 @@ static struct hwentry default_hw[] = { .rr_weight = RR_WEIGHT_NONE, .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, - .checker_name = READSECTOR0, + .checker_name = DIRECTIO, + .prio_name = DEFAULT_PRIO, }, {/* MSA 1000/MSA1500 EVA 3000/5000 with old firmware */ .vendor = "(COMPAQ|HP)", .product = "(MSA|HSV)1.0.*", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_hp_sw /dev/%n", .features = "1 queue_if_no_path", .hwhandler = "1 hp-sw", .selector = DEFAULT_SELECTOR,@@ -104,13 +104,13 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = HP_SW, + .prio_name = PRIO_HP_SW, }, {/* MSA 1000/1500 with new firmware */ .vendor = "HP", .product = "MSA VOLUME", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_alua /dev/%n", .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -120,12 +120,12 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = PRIO_ALUA, }, { .vendor = "HP", .product = "MSA2000s*", .getuid = "/sbin/cciss_id %n", - .getprio = NULL, .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -135,13 +135,13 @@ static struct hwentry default_hw[] = { .no_path_retry = 12, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = DEFAULT_PRIO, }, {/* EVA 3000/5000 with new firmware */ .vendor = "(COMPAQ|HP)", .product = "(MSA|HSV)1.1.*", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_alua /dev/%n", .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -151,13 +151,13 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = PRIO_ALUA, }, {/* EVA 4000/6000/8000 */ .vendor = "HP", .product = "HSV2.*", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_alua /dev/%n", .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -167,13 +167,13 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = PRIO_ALUA, }, {/* HP Smart Array */ .vendor = "HP", .product = "LOGICAL VOLUME.*", .getuid = "/lib/udev/scsi_id -n -g -u -s /block/%n", - .getprio = NULL, .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -183,6 +183,7 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = DEFAULT_PRIO, },/* * DDN controller family @@ -194,7 +195,6 @@ static struct hwentry default_hw[] = { .vendor = "DDN", .product = "SAN DataDirector", .getuid = DEFAULT_GETUID, - .getprio = NULL, .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -204,6 +204,7 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = DIRECTIO, + .prio_name = DEFAULT_PRIO, },/* * EMC / Clariion controller family @@ -215,7 +216,6 @@ static struct hwentry default_hw[] = { .vendor = "EMC", .product = "SYMMETRIX", .getuid = "/lib/udev/scsi_id -g -u -ppre-spc3-83 -s /block/%n", - .getprio = NULL, .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -224,14 +224,14 @@ static struct hwentry default_hw[] = { .rr_weight = RR_WEIGHT_NONE, .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, - .checker_name = READSECTOR0, + .checker_name = DIRECTIO, + .prio_name = DEFAULT_PRIO, }, { .vendor = "DGC", .product = ".*", .bl_product = "LUNZ", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_emc /dev/%n", .features = "1 queue_if_no_path", .hwhandler = "1 emc", .selector = DEFAULT_SELECTOR,@@ -241,6 +241,7 @@ static struct hwentry default_hw[] = { .no_path_retry = (300 / DEFAULT_CHECKINT), .minio = DEFAULT_MINIO, .checker_name = EMC_CLARIION, + .prio_name = PRIO_EMC, },/* * Fujitsu controller family @@ -252,7 +253,6 @@ static struct hwentry default_hw[] = { .vendor = "FSC", .product = "CentricStor", .getuid = DEFAULT_GETUID, - .getprio = NULL, .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -261,7 +261,8 @@ static struct hwentry default_hw[] = { .rr_weight = RR_WEIGHT_NONE, .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, - .checker_name = READSECTOR0, + .checker_name = DIRECTIO, + .prio_name = DEFAULT_PRIO, },/* * Hitachi controller family @@ -273,7 +274,6 @@ static struct hwentry default_hw[] = { .vendor = "(HITACHI|HP)", .product = "OPEN-.*", .getuid = DEFAULT_GETUID, - .getprio = NULL, .features = "1 queue_if_no_path", .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -283,12 +283,12 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = DEFAULT_PRIO, }, { .vendor = "HITACHI", .product = "DF.*", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_hds_modular /dev/%n", .features = "1 queue_if_no_path", .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -298,6 +298,7 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = PRIO_HDS, },/* * IBM controller family @@ -309,7 +310,6 @@ static struct hwentry default_hw[] = { .vendor = "IBM", .product = "ProFibre 4000R", .getuid = DEFAULT_GETUID, - .getprio = NULL, .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -318,14 +318,14 @@ static struct hwentry default_hw[] = { .rr_weight = RR_WEIGHT_NONE, .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, - .checker_name = READSECTOR0, + .checker_name = DIRECTIO, + .prio_name = DEFAULT_PRIO, }, {/* IBM DS4100 / FAStT100 */ .vendor = "IBM", .product = "1742", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_rdac /dev/%n", .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -335,13 +335,13 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = PRIO_RDAC, }, {/* IBM Netfinity Fibre Channel RAID Controller Unit */ .vendor = "IBM", .product = "3526", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_rdac /dev/%n", .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -351,13 +351,13 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = PRIO_RDAC, }, {/* IBM DS4200 / FAStT200 */ .vendor = "IBM", .product = "3542", .getuid = DEFAULT_GETUID, - .getprio = NULL, .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -367,13 +367,13 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = DEFAULT_PRIO, }, {/* IBM ESS F20 aka Shark */ .vendor = "IBM", .product = "2105(800|F20)", .getuid = DEFAULT_GETUID, - .getprio = NULL, .features = "1 queue_if_no_path", .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -383,13 +383,13 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = DEFAULT_PRIO, }, {/* IBM DS6000 */ .vendor = "IBM", .product = "1750500", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_alua /dev/%n", .features = "1 queue_if_no_path", .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -399,13 +399,13 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = PRIO_ALUA, }, {/* IBM DS8000 */ .vendor = "IBM", .product = "2107900", .getuid = DEFAULT_GETUID, - .getprio = NULL, .features = "1 queue_if_no_path", .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -415,13 +415,13 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = DEFAULT_PRIO, }, {/* IBM SAN Volume Controller */ .vendor = "IBM", .product = "2145", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_alua /dev/%n", .features = "1 queue_if_no_path", .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -431,6 +431,7 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = PRIO_ALUA, }, {/* IBM S/390 ECKD DASD */ @@ -438,7 +439,6 @@ static struct hwentry default_hw[] = { .product = "S/390 DASD ECKD", .bl_product = "S/390.*", .getuid = "/sbin/dasdinfo -u -b %n", - .getprio = NULL, .features = "1 queue_if_no_path", .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -448,6 +448,7 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = DIRECTIO, + .prio_name = DEFAULT_PRIO, },/* * NETAPP controller family @@ -459,7 +460,6 @@ static struct hwentry default_hw[] = { .vendor = "NETAPP", .product = "LUN.*", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_netapp /dev/%n", .features = "1 queue_if_no_path", .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -468,7 +468,8 @@ static struct hwentry default_hw[] = { .rr_weight = RR_WEIGHT_NONE, .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = 128, - .checker_name = READSECTOR0, + .checker_name = DIRECTIO, + .prio_name = PRIO_NETAPP, },/* * IBM NSeries (NETAPP) controller family @@ -480,7 +481,6 @@ static struct hwentry default_hw[] = { .vendor = "IBM", .product = "Nseries.*", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_netapp /dev/%n", .features = "1 queue_if_no_path", .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -489,7 +489,8 @@ static struct hwentry default_hw[] = { .rr_weight = RR_WEIGHT_NONE, .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = 128, - .checker_name = READSECTOR0, + .checker_name = DIRECTIO, + .prio_name = PRIO_NETAPP, },/* * Pillar Data controller family @@ -501,7 +502,6 @@ static struct hwentry default_hw[] = { .vendor = "Pillar", .product = "Axiom.*", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_alua %n", .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -511,6 +511,7 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = PRIO_ALUA, },/* * SGI arrays @@ -522,7 +523,6 @@ static struct hwentry default_hw[] = { .vendor = "SGI", .product = "TP9[13]00", .getuid = DEFAULT_GETUID, - .getprio = NULL, .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -531,13 +531,13 @@ static struct hwentry default_hw[] = { .rr_weight = RR_WEIGHT_NONE, .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, - .checker_name = READSECTOR0, + .checker_name = DIRECTIO, + .prio_name = DEFAULT_PRIO, }, { .vendor = "SGI", .product = "TP9[45]00", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_rdac /dev/%n", .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -547,12 +547,12 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_QUEUE, .minio = DEFAULT_MINIO, .checker_name = RDAC, + .prio_name = PRIO_RDAC, }, { .vendor = "SGI", .product = "IS.*", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_rdac /dev/%n", .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -562,6 +562,7 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_QUEUE, .minio = DEFAULT_MINIO, .checker_name = RDAC, + .prio_name = PRIO_RDAC, },/* * STK arrays @@ -573,7 +574,6 @@ static struct hwentry default_hw[] = { .vendor = "STK", .product = "OPENstorage D280", .getuid = DEFAULT_GETUID, - .getprio = "/sbin/mpath_prio_rdac /dev/%n", .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -583,6 +583,7 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, .checker_name = TUR, + .prio_name = PRIO_RDAC, },/* * SUN arrays @@ -594,7 +595,6 @@ static struct hwentry default_hw[] = { .vendor = "SUN", .product = "(StorEdge 3510|T4)", .getuid = DEFAULT_GETUID, - .getprio = NULL, .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -603,7 +603,8 @@ static struct hwentry default_hw[] = { .rr_weight = RR_WEIGHT_NONE, .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = DEFAULT_MINIO, - .checker_name = READSECTOR0, + .checker_name = DIRECTIO, + .prio_name = DEFAULT_PRIO, },/* * Pivot3 RAIGE @@ -615,7 +616,6 @@ static struct hwentry default_hw[] = { .vendor = "PIVOT3", .product = "RAIGE VOLUME", .getuid = "/sbin/scsi_id -p 0x80 -g -u -s /block/%n", - .getprio = NULL, .features = "1 queue_if_no_path", .hwhandler = DEFAULT_HWHANDLER, .selector = DEFAULT_SELECTOR,@@ -625,6 +625,7 @@ static struct hwentry default_hw[] = { .no_path_retry = NO_PATH_RETRY_UNDEF, .minio = 100, .checker_name = TUR, + .prio_name = DEFAULT_PRIO, },/* * EOL @@ -633,7 +634,6 @@ static struct hwentry default_hw[] = { .vendor = NULL, .product = NULL, .getuid = NULL, - .getprio = NULL, .features = NULL, .hwhandler = NULL, .selector = NULL,@@ -643,6 +643,7 @@ static struct hwentry default_hw[] = { .no_path_retry = 0, .minio = 0, .checker_name = NULL, + .prio_name = NULL, }, };libmultipath/propsel.c +13
-11@@ -6,6 +6,7 @@#include <stdio.h> #include <checkers.h> +#include <libprio.h> #include "memory.h" #include "vector.h" @@ -257,22 +258,23 @@ select_getuid (struct path * pp) }extern int -select_getprio (struct path * pp) +select_prio (struct path * pp) { -if (pp->hwe && pp->hwe->getprio) { - pp->getprio = pp->hwe->getprio; -condlog (3 ,"%s: getprio = %s (controller setting)" , - pp->dev, pp->getprio); +if (pp->hwe && pp->hwe->prio) { + pp->prio = pp->hwe->prio; +condlog (3 ,"%s: prio = %s (controller setting)" , + pp->dev,prio_name (pp->prio));return 0 ; } -if (conf->getprio) { - pp->getprio = conf->getprio; -condlog (3 ,"%s: getprio = %s (config file default)" , - pp->dev, pp->getprio); +if (conf->prio) { + pp->prio = conf->prio; +condlog (3 ,"%s: prio = %s (config file default)" , + pp->dev,prio_name (pp->prio));return 0 ; } - pp->getprio =DEFAULT_GETPRIO ; -condlog (3 ,"%s: getprio = NULL (internal default)" , pp->dev); + pp->prio =prio_default (); +condlog (3 ,"%s: prio = %s (internal default)" , + pp->dev,prio_name (pp->prio));return 0 ; }libmultipath/propsel.h +1
-1@@ -7,7 +7,7 @@ int select_features (struct multipath * mp);int select_hwhandler (struct multipath * mp);int select_checker (struct path *pp);int select_getuid (struct path * pp); -int select_getprio (struct path * pp); +int select_prio (struct path * pp);int select_no_path_retry (struct multipath *mp);int select_pg_timeout (struct multipath *mp);int select_minio (struct multipath *mp);libmultipath/structs.h +1
-2@@ -121,8 +121,7 @@ struct path {int priority;int pgindex;char * getuid; -char * getprio; -int getprio_selected; +struct prio * prio;struct checker checker;struct multipath * mpp;int fd;libmultipath/structs_vec.c +2
-2@@ -3,6 +3,7 @@#include <unistd.h> #include <checkers.h> +#include <libprio.h> #include "vector.h" #include "defaults.h" @@ -81,8 +82,7 @@ orphan_path (struct path * pp) pp->mpp =NULL ; pp->dmstate =PSTATE_UNDEF ; pp->getuid =NULL ; - pp->getprio =NULL ; - pp->getprio_selected =0 ; +prio_put (pp->prio);checker_put (&pp->checker);if (pp->fd >=0 )close (pp->fd);multipath.conf.annotated +7
-8@@ -52,14 +52,14 @@ # getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n" # # # -# # name : prio_callout +# # name : prio # # scope : multipath -# # desc : the default program and args to callout to obtain a path +# # desc : the default function to call to obtain a path # # priority value. The ALUA bits in SPC-3 provide an -# # exploitable prio value for example. "none" is a valid value +# # exploitable prio value for example. # # default : (null) # # -# #prio_callout "/bin/true" +# #prio "alua" # # # # # name : path_checker@@ -296,15 +296,14 @@ # getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n" # # # -# # name : prio_callout +# # name : prio # # scope : multipath -# # desc : the program and args to callout to obtain a path +# # desc : the function to call to obtain a path # # weight. Weights are summed for each path group to # # determine the next PG to use case of failure. -# # "none" is a valid value. # # default : no callout, all paths equals # # -# prio_callout "/sbin/mpath_prio_balance_units %d" +# prio "hp_sw" # # # # # name : path_checkermultipath.conf.synthetic +1
-1@@ -8,7 +8,7 @@ # selector "round-robin 0" # path_grouping_policy multibus # getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n" -# prio_callout /bin/true +# prio const # path_checker directio # rr_min_io 100 # rr_weight prioritiesmultipathd/Makefile +4
-0@@ -21,6 +21,7 @@ LDFLAGS = -lpthread -ldevmapper -lreadline -lncurses -laio # OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o \ $(MULTIPATHLIB)-glibc.a $(CHECKERSLIB)-glibc.a \ + $(LIBPRIO)-glibc.a #@@ -37,6 +38,9 @@ $(EXEC): clean $(OBJS) $(CC) $(OBJS) -o $(EXEC) $(LDFLAGS) $(GZIP) $(EXEC).8 > $(EXEC).8.gz +$(LIBPRIO)-glibc.a: + $(MAKE) -C $(libpriodir) BUILD=glibc glibc + $(CHECKERSLIB)-glibc.a: $(MAKE) -C $(checkersdir) BUILD=glibc glibc
Quoted 18 lines
Quoted 5 lines
Ben, Christophe,
Is that code still problem for current multipathd? And what do you think about my proposal?I'm not found of yet-another user-visible ramfs for multipathd use, that's why I started with the private namespace tricks. The problems are still there, and will stay till we stop using pthreads.
That may happen someday, as one of the main reason for pthread was the (blocking ioctl) libdevmapper event collection. And this is being superseded by path status uevents.
But not soon enough, and the private namespace stuff suffers from lack of friendliness anyway : we can't expect users to grasp easily that changing their prioritizer in /sbin won't be seen by the multipath daemon till restart, for example.
Quoted 7 lines
So I propose to start playing with your prioritizers-as-lib idea to see if it's practical.
I prepared the following patch to that effect. It is not complete (actually segfaults, no useful prioritizer ported) but can start fixing bugs and go where ever your personnal interest leads.
I'm sorry I forgot to post the git-cached part of the changeset, i.e. libprio/ files.
There it goes.
Makefile.inc +2 -0
@@ -24,6 +24,7 @@ exec_prefix = $(prefix) bindir = $(exec_prefix)/sbin libudevdir = ${prefix}/lib/udev checkersdir = $(TOPDIR)/libcheckers +libpriodir = $(TOPDIR)/libprio multipathdir = $(TOPDIR)/libmultipath mandir = $(prefix)/usr/share/man/man8 man5dir = $(prefix)/usr/share/man/man5
@@ -33,6 +34,7 @@ GZIP = /bin/gzip -9 -c CHECKERSLIB = $(checkersdir)/libcheckers MULTIPATHLIB = $(multipathdir)/libmultipath +LIBPRIO = $(libpriodir)/libprio INSTALL_PROGRAM = install -s
libmultipath/Makefile +1 -1
@@ -6,7 +6,7 @@ BUILD = glibc include ../Makefile.inc -CFLAGS += -I$(checkersdir) +CFLAGS += -I$(checkersdir) -I$(libpriodir) OBJS = memory.o parser.o vector.o devmapper.o callout.o \ hwtable.o blacklist.o util.o dmparser.o config.o \
libmultipath/config.c +1 -9
@@ -135,9 +135,6 @@ free_hwe (struct hwentry * hwe)if (hwe->getuid)FREE (hwe->getuid); -if (hwe->getprio) -FREE (hwe->getprio); -if (hwe->features)FREE (hwe->features);
@@ -265,9 +262,6 @@ store_hwe (vector hwtable, struct hwentry * dhwe)if (dhwe->getuid && !(hwe->getuid =set_param_str (dhwe->getuid))) goto out; -if (dhwe->getprio && !(hwe->getprio =set_param_str (dhwe->getprio))) - goto out; -if (dhwe->features && !(hwe->features =set_param_str (dhwe->features))) goto out;
@@ -283,6 +277,7 @@ store_hwe (vector hwtable, struct hwentry * dhwe) hwe->no_path_retry = dhwe->no_path_retry; hwe->minio = dhwe->minio; hwe->checker = dhwe->checker; + hwe->prio = dhwe->prio;if (dhwe->bl_product && !(hwe->bl_product =set_param_str (dhwe->bl_product))) goto out;
@@ -321,9 +316,6 @@ free_config (struct config * conf)if (conf->getuid)FREE (conf->getuid); -if (conf->getprio) -FREE (conf->getprio); -if (conf->features)FREE (conf->features);
libmultipath/config.h +3 -2
@@ -16,11 +16,11 @@ struct hwentry {char * product;char * revision;char * getuid; -char * getprio;char * features;char * hwhandler;char * selector;char * checker_name; +char * prio_name;int pgpolicy;int pgfailback;
@@ -28,6 +28,7 @@ struct hwentry {int no_path_retry;int minio;int pg_timeout; +struct prio * prio;struct checker * checker;char * bl_product; };
@@ -53,6 +54,7 @@ struct config {int pgpolicy_flag;int with_sysfs;int pgpolicy; +struct prio * prio;struct checker * checker;enum devtypes dev_type;int minio;
@@ -70,7 +72,6 @@ struct config {char * udev_dir;char * selector;char * getuid; -char * getprio;char * features;char * hwhandler;char * bindings_file;
libmultipath/defaults.h +0 -1
@@ -4,7 +4,6 @@#define DEFAULT_FEATURES "0"#define DEFAULT_HWHANDLER "0"#define DEFAULT_MINIO 1000 -#define DEFAULT_GETPRIO NULL#define DEFAULT_PGPOLICY FAILOVER#define DEFAULT_FAILBACK -FAILBACK_MANUAL#define DEFAULT_RR_WEIGHT RR_WEIGHT_NONE
libmultipath/dict.c +28 -38
132 lines not on this page · raw message
libmultipath/discovery.c +9 -19
@@ -12,6 +12,7 @@#include <errno.h> #include <checkers.h> +#include <libprio.h> #include "vector.h" #include "memory.h"
@@ -626,27 +627,16 @@ get_state (struct path * pp)static int get_prio (struct path * pp) { -char buff[CALLOUT_MAX_SIZE ]; -char prio[16 ]; - -if (!pp->getprio_selected) { -select_getprio (pp); - pp->getprio_selected =1 ; - } -if (!pp->getprio) { - pp->priority =PRIO_DEFAULT ; - }else if (apply_format (pp->getprio, &buff[0 ], pp)) { -condlog (0 ,"error formatting prio callout command" ); - pp->priority =PRIO_UNDEF ; -return 1 ; - }else if (execute_program (buff, prio,16 )) { -condlog (0 ,"error calling out %s" , buff); +if (!prio_selected (pp->prio)) +select_prio (pp); + pp->priority =prio_getprio (pp->prio, pp); +if (pp->priority <0 ) { +condlog (0 ,"%s: %s prio error" , pp->dev,prio_name (pp->prio)); pp->priority =PRIO_UNDEF ;return 1 ; - }else - pp->priority =atoi (prio); - -condlog (3 ,"%s: prio = %u" , pp->dev, pp->priority); + } +condlog (3 ,"%s: %s prio = %u" , + pp->dev,prio_name (pp->prio), pp->priority);return 0 ; }
libmultipath/hwtable.c +44 -43
507 lines not on this page · raw message
libmultipath/propsel.c +13 -11
@@ -6,6 +6,7 @@#include <stdio.h> #include <checkers.h> +#include <libprio.h> #include "memory.h" #include "vector.h"
@@ -257,22 +258,23 @@ select_getuid (struct path * pp) }extern int -select_getprio (struct path * pp) +select_prio (struct path * pp) { -if (pp->hwe && pp->hwe->getprio) { - pp->getprio = pp->hwe->getprio; -condlog (3 ,"%s: getprio = %s (controller setting)" , - pp->dev, pp->getprio); +if (pp->hwe && pp->hwe->prio) { + pp->prio = pp->hwe->prio; +condlog (3 ,"%s: prio = %s (controller setting)" , + pp->dev,prio_name (pp->prio));return 0 ; } -if (conf->getprio) { - pp->getprio = conf->getprio; -condlog (3 ,"%s: getprio = %s (config file default)" , - pp->dev, pp->getprio); +if (conf->prio) { + pp->prio = conf->prio; +condlog (3 ,"%s: prio = %s (config file default)" , + pp->dev,prio_name (pp->prio));return 0 ; } - pp->getprio =DEFAULT_GETPRIO ; -condlog (3 ,"%s: getprio = NULL (internal default)" , pp->dev); + pp->prio =prio_default (); +condlog (3 ,"%s: prio = %s (internal default)" , + pp->dev,prio_name (pp->prio));return 0 ; }
libmultipath/propsel.h +1 -1
@@ -7,7 +7,7 @@ int select_features (struct multipath * mp);int select_hwhandler (struct multipath * mp);int select_checker (struct path *pp);int select_getuid (struct path * pp); -int select_getprio (struct path * pp); +int select_prio (struct path * pp);int select_no_path_retry (struct multipath *mp);int select_pg_timeout (struct multipath *mp);int select_minio (struct multipath *mp);
libmultipath/structs.h +1 -2
@@ -121,8 +121,7 @@ struct path {int priority;int pgindex;char * getuid; -char * getprio; -int getprio_selected; +struct prio * prio;struct checker checker;struct multipath * mpp;int fd;
libmultipath/structs_vec.c +2 -2
@@ -3,6 +3,7 @@#include <unistd.h> #include <checkers.h> +#include <libprio.h> #include "vector.h" #include "defaults.h"
@@ -81,8 +82,7 @@ orphan_path (struct path * pp) pp->mpp =NULL ; pp->dmstate =PSTATE_UNDEF ; pp->getuid =NULL ; - pp->getprio =NULL ; - pp->getprio_selected =0 ; +prio_put (pp->prio);checker_put (&pp->checker);if (pp->fd >=0 )close (pp->fd);
multipath.conf.annotated +7 -8
@@ -52,14 +52,14 @@ # getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n" # # # -# # name : prio_callout +# # name : prio # # scope : multipath -# # desc : the default program and args to callout to obtain a path +# # desc : the default function to call to obtain a path # # priority value. The ALUA bits in SPC-3 provide an -# # exploitable prio value for example. "none" is a valid value +# # exploitable prio value for example. # # default : (null) # # -# #prio_callout "/bin/true" +# #prio "alua" # # # # # name : path_checker
@@ -296,15 +296,14 @@ # getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n" # # # -# # name : prio_callout +# # name : prio # # scope : multipath -# # desc : the program and args to callout to obtain a path +# # desc : the function to call to obtain a path # # weight. Weights are summed for each path group to # # determine the next PG to use case of failure. -# # "none" is a valid value. # # default : no callout, all paths equals # # -# prio_callout "/sbin/mpath_prio_balance_units %d" +# prio "hp_sw" # # # # # name : path_checker
multipath.conf.synthetic +1 -1
@@ -8,7 +8,7 @@ # selector "round-robin 0" # path_grouping_policy multibus # getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n" -# prio_callout /bin/true +# prio const # path_checker directio # rr_min_io 100 # rr_weight priorities
multipathd/Makefile +4 -0
@@ -21,6 +21,7 @@ LDFLAGS = -lpthread -ldevmapper -lreadline -lncurses -laio # OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o \ $(MULTIPATHLIB)-glibc.a $(CHECKERSLIB)-glibc.a \ + $(LIBPRIO)-glibc.a #
@@ -37,6 +38,9 @@ $(EXEC): clean $(OBJS) $(CC) $(OBJS) -o $(EXEC) $(LDFLAGS) $(GZIP) $(EXEC).8 > $(EXEC).8.gz +$(LIBPRIO)-glibc.a: + $(MAKE) -C $(libpriodir) BUILD=glibc glibc + $(CHECKERSLIB)-glibc.a: $(MAKE) -C $(checkersdir) BUILD=glibc glibc
libprio/Makefile new file +27 -0
@@ -0,0 +1,27 @@ +# Makefile +# +# Copyright (C) 2007 Christophe Varoqui, <[email protected]> +# +BUILD = glibc + +include ../Makefile.inc + +OBJS = libprio.o random.o const.o hp_sw.o emc.o rdac.o alua.o netapp.o hds.o + +all: $(BUILD) + +prepare: + @file *-$(BUILD).a >/dev/null 2>&1 || rm -f core *.o *.gz + +klibc: prepare $(OBJS) + ar rs libprio-klibc.a *.o + +glibc: prepare $(OBJS) + ar rs libprio-glibc.a *.o + +install: + +uninstall: + +clean: + rm -f core *.a *.o *.gz
libprio/alua.c new file +8 -0
@@ -0,0 +1,8 @@ +#include <stdio.h> + +#include "libprio.h" + +int prio_alua (struct path * pp) +{ +return 1 ; +}
libprio/alua.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef _ALUA_H +#define _ALUA_H + +#define PRIO_ALUA "alua" +int prio_alua (struct path * pp); + +#endif
libprio/const.c new file +8 -0
@@ -0,0 +1,8 @@ +#include <stdio.h> + +#include "libprio.h" + +int prio_const (struct path * pp) +{ +return 1 ; +}
libprio/const.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef _CONST_H +#define _CONST_H + +#define PRIO_CONST "const" +int prio_const (struct path * pp); + +#endif
libprio/emc.c new file +8 -0
@@ -0,0 +1,8 @@ +#include <stdio.h> + +#include "libprio.h" + +int prio_emc (struct path * pp) +{ +return 1 ; +}
libprio/emc.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef _EMC_H +#define _EMC_H + +#define PRIO_EMC "emc" +int prio_emc (struct path * pp); + +#endif
libprio/hds.c new file +8 -0
@@ -0,0 +1,8 @@ +#include <stdio.h> + +#include "libprio.h" + +int prio_hds (struct path * pp) +{ +return 1 ; +}
libprio/hds.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef _HDS_H +#define _HDS_H + +#define PRIO_HDS "hds" +int prio_hds (struct path * pp); + +#endif
libprio/hp_sw.c new file +8 -0
@@ -0,0 +1,8 @@ +#include <stdio.h> + +#include "libprio.h" + +int prio_hp_sw (struct path * pp) +{ +return 1 ; +}
libprio/hp_sw.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef _HP_SW_H +#define _HP_SW_H + +#define PRIO_HP_SW "hp_sw" +int prio_hp_sw (struct path * pp); + +#endif
libprio/libprio.c new file +57 -0
57 lines not on this page · raw message
libprio/libprio.h new file +40 -0
@@ -0,0 +1,40 @@ +#ifndef _LIBPRIO_H +#define _LIBPRIO_H + +/* +* knowing about path struct gives flexibility to prioritizers +*/ +#include "../libcheckers/checkers.h" +#include "../libmultipath/vector.h" +#include "../libmultipath/structs.h" + +#include "const.h" +#include "random.h" +#include "hp_sw.h" +#include "alua.h" +#include "emc.h" +#include "netapp.h" +#include "hds.h" +#include "rdac.h" + +#define DEFAULT_PRIO PRIO_CONST + +/* +* strings lengths +*/ +#define PRIO_NAME_LEN 16 +#define PRIO_DEV_LEN 256 + +struct prio { +char name[PRIO_NAME_LEN ]; +int (*getprio)(struct path *); +}; + +struct prio *prio_lookup (char *); +int prio_getprio (struct prio * p,struct path * pp); +int prio_selected (struct prio *); +void prio_put (struct prio *); +char *prio_name (struct prio *); +struct prio *prio_default (void ); + +#endif /* _LIBPRIO_H */
libprio/netapp.c new file +8 -0
@@ -0,0 +1,8 @@ +#include <stdio.h> + +#include "libprio.h" + +int prio_netapp (struct path * pp) +{ +return 1 ; +}
libprio/netapp.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef _NETAPP_H +#define _NETAPP_H + +#define PRIO_NETAPP "netapp" +int prio_netapp (struct path * pp); + +#endif
libprio/random.c new file +16 -0
@@ -0,0 +1,16 @@ +#include <stdio.h> +#include <stdlib.h> +#include <sys/time.h> +#include <time.h> + +#include "libprio.h" + +int prio_random (struct path * pp) +{ +struct timeval tv; + +gettimeofday (&tv,NULL ); +srand ((unsigned int )tv.tv_usec); +printf ("%i\n" ,1 +(int ) (10.0 *rand ()/(RAND_MAX +1.0 ))); +return 0 ; +}
libprio/random.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef _RANDOM_H +#define _RANDOM_H + +#define PRIO_RANDOM "random" +int prio_random (struct path * pp); + +#endif
libprio/rdac.c new file +8 -0
@@ -0,0 +1,8 @@ +#include <stdio.h> + +#include "libprio.h" + +int prio_rdac (struct path * pp) +{ +return 1 ; +}
libprio/rdac.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef _RDAC_H +#define _RDAC_H + +#define PRIO_RDAC "rdac" +int prio_rdac (struct path * pp); + +#endif
Quoted 20 lines · Christophe Varoqui
Quoted 20 lines
Quoted 4 lines
Ben, Christophe,
Is that code still problem for current multipathd? And what do you think about my proposal?I'm not found of yet-another user-visible ramfs for multipathd use, that's why I started with the private namespace tricks. The problems are still there, and will stay till we stop using pthreads.
That may happen someday, as one of the main reason for pthread was the (blocking ioctl) libdevmapper event collection. And this is being superseded by path status uevents.
But not soon enough, and the private namespace stuff suffers from lack of friendliness anyway : we can't expect users to grasp easily that changing their prioritizer in /sbin won't be seen by the multipath daemon till restart, for example.
So I propose to start playing with your prioritizers-as-lib idea to see if it's practical.
Quoted 8 lines
Quoted 4 lines
I prepared the following patch to that effect. It is not complete (actually segfaults, no useful prioritizer ported) but can start fixing bugs and go where ever your personnal interest leads.
I'm sorry I forgot to post the git-cached part of the changeset, i.e. libprio/ files.
There it goes.
Upstream git hosts the initial libprio/ commit.
I ported all useful prioritizers, leaving balance_units in the dark. (If someone is actually using it, please say so)
This time, I cared for a bit of testing and the stuff seems to actually work.
Now I'm interested in feedback from the Netapp fault injection team. And any other feedback.
Regards,
cvaroqui
Quoted 1 line
Hi Christophe,
Quoted 14 lines · Christophe Varoqui
Quoted 11 lines
Quoted 6 lines
So I propose to start playing with your prioritizers-as-lib idea to see if it's practical.
I prepared the following patch to that effect. It is not complete (actually segfaults, no useful prioritizer ported) but can start fixing bugs and go where ever your personnal interest leads.
I'm sorry I forgot to post the git-cached part of the changeset, i.e. libprio/ files.
There it goes.
Upstream git hosts the initial libprio/ commit.
Quoted 8 lines
I ported all useful prioritizers, leaving
balance_unitsin the dark. (If someone is actually using it, please say so)This time, I cared for a bit of testing and the stuff seems to actually work.
Now I'm interested in feedback from the Netapp fault injection team. And any other feedback.
Thank you for the libprio coding. And I'm sorry for my late reply.
I checked the commit and found a bug during my small testing. I'll send a patch to fix it by another email.
I would like to note that we lost the priority callout feature completely to fix the stall problem of root multipath.
Although below is just my humble opinion, I guess it was useful for people who want to use new prioritizers on official distro's environments until an update package including the prioritizer is released.
So if such a case often happens, adding other ways to use external prioritizers (perhaps dynamic loading library module like LVM2) would be required in the near future.
Thanks,
Kiyoshi Ueda