[dm-devel] [PATCH] multipath-tools: alua: add prefix with device name for asymmetric access state and reported target port group messages

2016-10-27 Thread Xose Vazquez Perez
Before:
Oct 27 15:11:21 | reported target port group is 2
Oct 27 15:11:21 | aas = 01 [active/non-optimized]

After:
Oct 27 15:11:47 | sda: reported target port group is 2
Oct 27 15:11:47 | sda: aas = 01 [active/non-optimized]

Cc: Benjamin Marzinski 
Cc: Hannes Reinecke 
Cc: Christophe Varoqui 
Cc: device-mapper development 
Signed-off-by: Xose Vazquez Perez 
---
 libmultipath/prioritizers/alua.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libmultipath/prioritizers/alua.c b/libmultipath/prioritizers/alua.c
index f5456ee..03d0a0e 100644
--- a/libmultipath/prioritizers/alua.c
+++ b/libmultipath/prioritizers/alua.c
@@ -65,12 +65,12 @@ get_alua_info(struct path * pp, unsigned int timeout)
return -ALUA_PRIO_NOT_SUPPORTED;
return -ALUA_PRIO_RTPG_FAILED;
}
-   condlog(3, "reported target port group is %i", tpg);
+   condlog(3, "%s: reported target port group is %i", pp->dev, tpg);
rc = get_asymmetric_access_state(pp->fd, tpg, timeout);
if (rc < 0)
return -ALUA_PRIO_GETAAS_FAILED;
 
-   condlog(3, "aas = %02x [%s]%s", rc, aas_print_string(rc),
+   condlog(3, "%s: aas = %02x [%s]%s", pp->dev, rc, aas_print_string(rc),
(rc & 0x80) ? " [preferred]" : "");
return rc;
 }
-- 
2.10.1

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


[dm-devel] [PATCH] multipath-tools: clean up and organize multipath/multipath.8

2016-10-27 Thread Xose Vazquez Perez
Cc: Christophe Varoqui 
Cc: device-mapper development 
Signed-off-by: Xose Vazquez Perez 
---
 multipath/multipath.8 | 159 ++
 1 file changed, 109 insertions(+), 50 deletions(-)

diff --git a/multipath/multipath.8 b/multipath/multipath.8
index 966139e..f0b1ff0 100644
--- a/multipath/multipath.8
+++ b/multipath/multipath.8
@@ -1,7 +1,24 @@
-.TH MULTIPATH 8 "July 2006" "" "Linux Administrator's Manual"
+.\" 

+.\" Update the date below if you make any significant change.
+.\" Make sure there are no errors with:
+.\" groff -z -wall -b -e -t multipath/multipath.8
+.\"
+.\" 

+.
+.TH MULTIPATH 8 2016-10-26 "Linux"
+.
+.
+.\" 

 .SH NAME
-multipath \- Device mapper target autoconfig
+.\" 

+.
+multipath \- Device mapper target autoconfig.
+.
+.
+.\" 

 .SH SYNOPSIS
+.\" 

+.
 .B multipath
 .RB [\| \-v\ \c
 .IR verbosity \|]
@@ -10,124 +27,166 @@ multipath \- Device mapper target autoconfig
 .RB [\| \-d \|]
 .RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \|-i | 
\-a | \|-u | \-w | \-W \|]
 .RB [\| \-p\ \c
-.BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name 
\|]
+.IR failover | multibus | group_by_serial | group_by_prio | group_by_node_name 
\|]
 .RB [\| device \|]
+.
+.
+.\" 

 .SH DESCRIPTION
+.\" 

+.
 .B multipath
 is used to detect and coalesce multiple paths to devices, for fail-over or 
performance reasons.
+.
+.
+.\" 

 .SH OPTIONS
+.\" 

+.
 .TP
-.B \-v " level"
-verbosity, print all paths and multipaths
+.BI \-v " level"
+Verbosity, print all paths and multipaths:
 .RS 1.2i
 .TP 1.2i
-.B 0
-no output
+.I 0
+No output.
 .TP
-.B 1
-print the created or updated multipath names only, for use to feed other tools 
like kpartx
+.I 1
+Print the created or updated multipath names only, for use to feed other tools 
like kpartx.
 .TP
-.B 2 +
-print all info : detected paths, coalesced paths (ie multipaths) and device 
maps
+.I 2 +
+Print all info: detected paths, coalesced paths (ie multipaths) and device 
maps.
 .RE
+.
 .TP
 .B \-h
-print usage text
+Print usage text.
+.
 .TP
 .B \-d
-dry run, do not create or update devmaps
+Dry run, do not create or update devmaps.
+.
 .TP
 .B \-l
-show the current multipath topology from information fetched in sysfs and the 
device mapper
+Show the current multipath topology from information fetched in sysfs and the 
device mapper.
+.
 .TP
 .B \-ll
-show the current multipath topology from all available information (sysfs, the 
device mapper, path checkers ...)
+Show the current multipath topology from all available information (sysfs, the 
device mapper, path checkers ...).
+.
 .TP
 .B \-f
-flush a multipath device map specified as parameter, if unused
+Flush a multipath device map specified as parameter, if unused.
+.
 .TP
 .B \-F
-flush all unused multipath device maps
+Flush all unused multipath device maps.
+.
 .TP
 .B \-t
-print internal hardware table to stdout
+Print internal hardware table to stdout.
+.
 .TP
 .B \-r
-force devmap reload
+Force devmap reload.
+.
 .TP
 .B \-i
-ignore wwids file when processing devices
+Ignore WWIDs file when processing devices.
+.
 .TP
 .B \-B
-treat the bindings file as read only
+Treat the bindings file as read only.
+.
 .TP
-.B \-b " bindings_file"
-set user_friendly_names bindings file location.  The default is
-/etc/multipath/bindings
+.BI \-b " bindings_file"
+Set user_friendly_names bindings file location.  The default is
+\fI/etc/multipath/bindings\fR.
+.
 .TP
 .B \-c
-check if a block device should be a path in a multipath device
+Check if a block device should be a path in a multipath device.
+.
 .TP
 .B \-q
-allow device tables with queue_if_no_path when multipathd is not running
+Allow device tables with \fIqueue_if_no_path\fR when multipathd is not running.
+.
 .TP
 .B \-a
-add the wwid for the specified device to the wwids file
+Add the WWID for the specified device to the WWIDs file.
+.
 .TP
 .B \-u
-check if the device specified in the program environment should be
+Check if the device specified in the program environment should be
 a path in a multipath device.
+.
 .TP
 .B \-w
-remove the wwid for the 

[dm-devel] [PATCH] mpathpersistent: segment faulty occured in mpath_persistent_reserve_in()

2016-10-27 Thread tang . wenji
From: 10111224 

Segment faulty occured when executing "mpathpersist -i -k
/dev/mapper/mpath1" command.The reason is that an uninitialized global variable 
conf is used in mpath_persistent_reserve_in(). The same problem also exists in
mpath_persistent_reserve_out().

Signed-off-by: tang.wenji 
---
 libmpathpersist/mpath_persist.c | 21 +++--
 libmpathpersist/mpathpr.h   |  4 
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 7501651..582d4ef 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -78,6 +78,7 @@ updatepaths (struct multipath * mpp)
int i, j;
struct pathgroup * pgp;
struct path * pp;
+   struct config *conf;
 
if (!mpp->pg)
return 0;
@@ -97,16 +98,24 @@ updatepaths (struct multipath * mpp)
continue;
}
pp->mpp = mpp;
+   conf = get_multipath_config();
pathinfo(pp, conf, DI_ALL);
+   put_multipath_config(conf);
continue;
}
pp->mpp = mpp;
if (pp->state == PATH_UNCHECKED ||
-   pp->state == PATH_WILD)
+   pp->state == PATH_WILD){
+   conf = get_multipath_config();
pathinfo(pp, conf, DI_CHECKER);
+   put_multipath_config(conf);
+   }
 
-   if (pp->priority == PRIO_UNDEF)
+   if (pp->priority == PRIO_UNDEF){
+   conf = get_multipath_config();
pathinfo(pp, conf, DI_PRIO);
+   put_multipath_config(conf);
+   }
}
}
return 0;
@@ -159,8 +168,11 @@ int mpath_persistent_reserve_in (int fd, int rq_servact,
int map_present;
int major, minor;
int ret;
+   struct config *conf;
 
+   conf = get_multipath_config();
conf->verbosity = verbose;
+   put_multipath_config( conf);
 
if (fstat( fd, ) != 0){
condlog(0, "stat error %d", fd);
@@ -252,8 +264,11 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, 
int rq_scope,
int j;
unsigned char *keyp;
uint64_t prkey;
+   struct config *conf;
 
+   conf = get_multipath_config();
conf->verbosity = verbose;
+   put_multipath_config(conf);
 
if (fstat( fd, ) != 0){
condlog(0, "stat error fd=%d", fd);
@@ -320,7 +335,9 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, 
int rq_scope,
goto out1;
}
 
+   conf = get_multipath_config();
select_reservation_key(conf, mpp);
+   put_multipath_config(conf);
 
switch(rq_servact)
{
diff --git a/libmpathpersist/mpathpr.h b/libmpathpersist/mpathpr.h
index cd58201..e6c2ded 100644
--- a/libmpathpersist/mpathpr.h
+++ b/libmpathpersist/mpathpr.h
@@ -25,10 +25,6 @@ struct threadinfo {
struct prout_param param;
 };
 
-
-struct config * conf;
-
-
 int prin_do_scsi_ioctl(char * dev, int rq_servact, struct prin_resp * resp, 
int noisy);
 int prout_do_scsi_ioctl( char * dev, int rq_servact, int rq_scope,
unsigned int rq_type, struct prout_param_descriptor *paramp, 
int noisy);
-- 
2.8.1.windows.1

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel