multipath-tools/.git
3 years agomultipathd: fix some small bugs for cli socket
tang.junhui [Thu, 11 Aug 2016 11:01:20 +0000 (19:01 +0800)]
multipathd: fix some small bugs for cli socket

1) mpath_recv_reply_len() should return error when the length which received by read_all() is wrong;
2) The buffer which *reply point to maybe null when mpath_recv_reply() return with success,
   so the caller needs to determine whether it is null, and then to use
   it.

Signed-off-by: tang.junhui <tang.junhui@zte.com.cn>
3 years agomultipathd: Remove a busy-waiting loop
Bart Van Assche [Mon, 15 Aug 2016 15:28:29 +0000 (08:28 -0700)]
multipathd: Remove a busy-waiting loop

Use pthread_join() to wait until worker threads have finished
instead of using a counter to keep track of how many threads are
trying to grab a mutex. Remove mutex_lock.depth since this member
variable is no longer needed.

This patch fixes two race conditions:
* Incrementing "depth" in lock() without holding a mutex.
* Destroying a mutex from the main thread without waiting for the
  worker threads to finish using that mutex.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agolibmultipath: Introduce timedlock()
Bart Van Assche [Mon, 15 Aug 2016 15:27:19 +0000 (08:27 -0700)]
libmultipath: Introduce timedlock()

Introduce the function timedlock(). Ensure that the value of the
"depth" member value is incorrect if pthread_mutex_timedlock()
times out.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agolibmultipath: Inline mutex in struct mutex_lock
Bart Van Assche [Mon, 15 Aug 2016 15:27:01 +0000 (08:27 -0700)]
libmultipath: Inline mutex in struct mutex_lock

This simplifies the struct mutex_lock allocation and deallocation
code.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agolibmultipath: Convert lock() and unlock() into inline functions
Bart Van Assche [Mon, 15 Aug 2016 15:26:39 +0000 (08:26 -0700)]
libmultipath: Convert lock() and unlock() into inline functions

Convert lock() and unlock() from macros into inline functions.
This conversion makes it possible for the compiler to perform
type checking on the lock() and unlock() arguments. However,
this makes it necessary to change the argument type from "struct
mutex_lock" into "struct mutex_lock *".

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agolibmultipath: Remove debugging code from lock.h
Bart Van Assche [Mon, 15 Aug 2016 15:26:15 +0000 (08:26 -0700)]
libmultipath: Remove debugging code from lock.h

There are better tools available to trace mutex lock and unlock
activity than the macros in this header file, e.g.
valgrind --tool=drd --trace-mutex=yes multipathd -d
Hence remove the debugging macros.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agolibmultipath: Remove a data structure that has been commented out
Bart Van Assche [Mon, 15 Aug 2016 15:25:58 +0000 (08:25 -0700)]
libmultipath: Remove a data structure that has been commented out

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agomultipathd: Don't call repair on blacklisted paths
Mike Christie [Mon, 15 Aug 2016 17:13:46 +0000 (12:13 -0500)]
multipathd: Don't call repair on blacklisted paths

This fixes a regression added in
015f87b16a7797a17afd514aec46e65c2a1a2f73

If a path is blacklisted the checkerloop will free the path so
don't call repair on it.

This moves the repair call down into check_path, because I think
we also do not need to call it for other cases where we cannot get
the uuid info or being orphaned.

Signed-off-by: Mike Christie <mchristi@redhat.com>
3 years agomultipath-tools: check for initialized checker before
Mike Christie [Mon, 15 Aug 2016 17:13:45 +0000 (12:13 -0500)]
multipath-tools: check for initialized checker before

This fixes a regression added with:
015f87b16a7797a17afd514aec46e65c2a1a2f73

We can hit a race where when pathinfo is setting up a path, the path
could have gone down already. In the DI_CHECKER chunk we then do not run
get_state and attach a checker. Later when check_path is run
path_offline could still return PATH_DOWN or PATH_REMOVED and
get_state is again not run so we do not get to attach a checker. I
was then running repair_path since the state was PATH_DOWN, and we then
hit a segfault.

This has us test if a checker is selected before running repair.

Signed-off-by: Mike Christie <mchristi@redhat.com>
3 years agomultipathd: fix memory allocation logic error for polls in uxsock_listen()
tang.junhui [Wed, 10 Aug 2016 09:32:40 +0000 (17:32 +0800)]
multipathd: fix memory allocation logic error for polls in uxsock_listen()

logic error exists in memory allocation for polls in uxsock_listen(), even if the allocated memory size meet the needs, it is still to realloc memory, which is not up to expectations.

Signed-off-by: tang.junhui <tang.junhui@zte.com.cn>
3 years agomultipath-tools: Add rbd to the hwtable
Mike Christie [Mon, 8 Aug 2016 12:01:50 +0000 (07:01 -0500)]
multipath-tools: Add rbd to the hwtable

Add rbd to hwtable. These defaults are for the HA type of setup
supported by the checker. We do no support features like multibus
at the dm-multipath level yet.

Changes since v1:
1. Drop settings that were defaults and follow template.
2. Drop ID_UID use.

Signed-off-by: Mike Christie <mchristi@redhat.com>
3 years agomultipath-tools: Add rbd checker.
Mike Christie [Mon, 8 Aug 2016 12:01:49 +0000 (07:01 -0500)]
multipath-tools: Add rbd checker.

This checker currently only handles the case where a path is failed
due to it being blacklisted by the ceph cluster. The specific use
case for me is when LIO exports rbd images through multiple LIO
instances.

The problem it handles is when rbd instance1 has the exclusive lock,
but becomes unreachable another host in the cluster will take over
and blacklist the instance1. This prevents it from sending stale IO
and corrupting data.

Later, when the host is reachable, we will want to failback to it.
To this, the checker will detect we were blacklisted, unmap the old
image which will make sure old IO is failed, and then remap the image
and unblacklist the host. multipathd will then handle this like a
path being removed and re-added.

Changes since v1:
1. Call the rbd command to remap images instead of trying to interact
with sysfs directly. This fixes ceph auth issues hit when using the
sysfs interface directly.

We currently do not support rbd root/boot. When that is supported we
will have a lib to interact with the kernel and we can then convert
to it.

Signed-off-by: Mike Christie <mchristi@redhat.com>
3 years agomultipath-tools: add checker callout to repair path
Mike Christie [Mon, 8 Aug 2016 12:01:48 +0000 (07:01 -0500)]
multipath-tools: add checker callout to repair path

This patch adds a callback which can be used to repair a path
if check() has determined it is in the PATH_DOWN state.

The next patch that adds rbd checker support which will use this to
handle the case where a rbd device is blacklisted.

Signed-off-by: Mike Christie <mchristi@redhat.com>
3 years agolibmultipath: add rbd discovery
Mike Christie [Mon, 8 Aug 2016 12:01:47 +0000 (07:01 -0500)]
libmultipath: add rbd discovery

rbd is a block device interface for Ceph. It does not support
any SCSI commands, so this patch adds bus detection and virtual
vendor/product pathinfo.

Changes since v1:
1. Drop ID_UID use and implemented sysfs getuid support.

Signed-off-by: Mike Christie <mchristi@redhat.com>
3 years agomultipath: fixup check for out-of-scope maps
Hannes Reinecke [Tue, 9 Aug 2016 07:31:13 +0000 (09:31 +0200)]
multipath: fixup check for out-of-scope maps

The 'wwid' in struct multipath is a static array, so a check for
the existence of 'wwid' is pointless. We should rather check if
the argument 'refwwid' is not NULL and has a length larger then '0'.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath/parser.c: correctly terminate buffer
Hannes Reinecke [Tue, 9 Aug 2016 07:31:12 +0000 (09:31 +0200)]
libmultipath/parser.c: correctly terminate buffer

The code would be returning a static NULL buffer instead of
terminating the original buffer.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath/discovery.c: use 'unsigned long' instead of 'unsigned int'
Hannes Reinecke [Tue, 9 Aug 2016 07:31:11 +0000 (09:31 +0200)]
libmultipath/discovery.c: use 'unsigned long' instead of 'unsigned int'

We should be using 'unsigned long' for the variable preferred.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agomultipath-tools: more fixes for multipath.conf.5
Xose Vazquez Perez [Sat, 6 Aug 2016 22:40:08 +0000 (00:40 +0200)]
multipath-tools: more fixes for multipath.conf.5

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: identify arrays at multipath.conf.5
Xose Vazquez Perez [Sat, 6 Aug 2016 22:40:07 +0000 (00:40 +0200)]
multipath-tools: identify arrays at multipath.conf.5

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: random fixes in multipath.conf.5
Xose Vazquez Perez [Sat, 6 Aug 2016 22:40:06 +0000 (00:40 +0200)]
multipath-tools: random fixes in multipath.conf.5

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: add dots(spaces) between sections and keywords
Xose Vazquez Perez [Sat, 6 Aug 2016 22:40:05 +0000 (00:40 +0200)]
multipath-tools: add dots(spaces) between sections and keywords

Cleaner layout.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: stand out sections headings with comments at multipath.conf.5
Xose Vazquez Perez [Sat, 6 Aug 2016 22:40:04 +0000 (00:40 +0200)]
multipath-tools: stand out sections headings with comments at multipath.conf.5

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: replace ".I" with \fIxxx\R at multipath.conf.5
Xose Vazquez Perez [Sat, 6 Aug 2016 22:40:03 +0000 (00:40 +0200)]
multipath-tools: replace ".I" with \fIxxx\R at multipath.conf.5

Leave ".I" only for values of keywords, now the layout is clearer. Also correct
some minor inconsistencies.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: remove "Optional" from some attributes in multipath.conf.5
Xose Vazquez Perez [Sat, 6 Aug 2016 22:40:02 +0000 (00:40 +0200)]
multipath-tools: remove "Optional" from some attributes in multipath.conf.5

Mandatory ones were already identified. Optional is redundant.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: revert add VIOLIN/CONCERTO ARRAY to hardware table
Xose Vazquez Perez [Sat, 6 Aug 2016 09:59:33 +0000 (11:59 +0200)]
multipath-tools: revert add VIOLIN/CONCERTO ARRAY to hardware table

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: revert add INFINIDAT devices to hardware table
Xose Vazquez Perez [Sat, 6 Aug 2016 09:59:32 +0000 (11:59 +0200)]
multipath-tools: revert add INFINIDAT devices to hardware table

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: revert add TEGILE devices to hardware table
Xose Vazquez Perez [Sat, 6 Aug 2016 09:59:31 +0000 (11:59 +0200)]
multipath-tools: revert add TEGILE devices to hardware table

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: inform that regex can be used in vendor, product, .revision and...
Xose Vazquez Perez [Fri, 5 Aug 2016 23:25:05 +0000 (01:25 +0200)]
multipath-tools: inform that regex can be used in vendor, product, .revision and bl_product

Right now some regexes are too wide, for example: "HITACHI"/"DF" or "SGI"/"IS".
They should be used more extensively, at least, in product-ID.
As I did in 34e345e8

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: add vendors' names as they are registered at T10
Xose Vazquez Perez [Fri, 5 Aug 2016 20:09:52 +0000 (22:09 +0200)]
multipath-tools: add vendors' names as they are registered at T10

For the record.

- Unregistered:
AIX
LIO-ORG
NEXENTA
TEGILE

- Registered at T10 with a different spelling/label:
EUROLOGC
HUAWEI
Intel

Real ones are:
"EuroLogc" - Eurologic Systems Limited (now part of PMC Sierra)
"HUASY"    - Huawei Symantec Technologies Co., Ltd.
"INTEL"    - Intel Corporation

HUASY has already been included in a previous patch.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: replace daddr_t type with long in kpartx/solaris.c
Xose Vazquez Perez [Thu, 4 Aug 2016 18:24:32 +0000 (20:24 +0200)]
multipath-tools: replace daddr_t type with long in kpartx/solaris.c

daddr_t is an unknow type for musl libc

musl-gcc output:
solaris.c:14:2: error: unknown type name ‘daddr_t’

Replace it with long.

Compiled tested only, please review.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: add <sys/types.h> to libmultipath/util.h
Xose Vazquez Perez [Thu, 4 Aug 2016 18:24:31 +0000 (20:24 +0200)]
multipath-tools: add <sys/types.h> to libmultipath/util.h

Require by musl libc:
In file included from pgpolicies.c:9:0:
util.h:11:1: error: unknown type name ‘dev_t’
 dev_t parse_devt(const char *dev_t);

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: remove pointless ".*" at the end of a regex
Xose Vazquez Perez [Thu, 4 Aug 2016 17:31:40 +0000 (19:31 +0200)]
multipath-tools: remove pointless ".*" at the end of a regex

At your option, they can be preserved to indicate "maybe anything could appear".

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: fix some comments in hwtable
Xose Vazquez Perez [Thu, 4 Aug 2016 17:25:59 +0000 (19:25 +0200)]
multipath-tools: fix some comments in hwtable

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: remove redundant ;
Xose Vazquez Perez [Wed, 3 Aug 2016 18:14:00 +0000 (20:14 +0200)]
multipath-tools: remove redundant ;

Found by checkpatch - WARNING: Statements terminations use 1 semicolon

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: indent switch and case at the same level
Xose Vazquez Perez [Wed, 3 Aug 2016 18:13:59 +0000 (20:13 +0200)]
multipath-tools: indent switch and case at the same level

Found by checkpatch - ERROR: switch and case should be at the same indent

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: remove indent from labels
Xose Vazquez Perez [Wed, 3 Aug 2016 18:13:58 +0000 (20:13 +0200)]
multipath-tools: remove indent from labels

Found by checkpatch - WARNING: labels should not be indented

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: fix spacing around operators
Xose Vazquez Perez [Wed, 3 Aug 2016 18:13:57 +0000 (20:13 +0200)]
multipath-tools: fix spacing around operators

Found by checkpatch - ERROR: need consistent spacing around "x"

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: add 'void' for no arguments functions
Xose Vazquez Perez [Wed, 3 Aug 2016 18:13:56 +0000 (20:13 +0200)]
multipath-tools: add 'void' for no arguments functions

Found by checkpatch - ERROR: Bad function definition

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: indent IBM Power Virtual
Xose Vazquez Perez [Wed, 3 Aug 2016 14:25:41 +0000 (16:25 +0200)]
multipath-tools: indent IBM Power Virtual

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: remove superfluous comments
Xose Vazquez Perez [Tue, 2 Aug 2016 17:59:55 +0000 (19:59 +0200)]
multipath-tools: remove superfluous comments

They are implicit in the attributes.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: identify devices at hwtable
Xose Vazquez Perez [Tue, 2 Aug 2016 16:57:14 +0000 (18:57 +0200)]
multipath-tools: identify devices at hwtable

And also correct some of them.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: add an advice about how to add new devices
Xose Vazquez Perez [Mon, 1 Aug 2016 21:10:54 +0000 (23:10 +0200)]
multipath-tools: add an advice about how to add new devices

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: add official name to Huawei devices
Xose Vazquez Perez [Mon, 1 Aug 2016 20:34:00 +0000 (22:34 +0200)]
multipath-tools: add official name to Huawei devices

from http://www.t10.org/ftp/t10/vendorid.txt
Its official name is: "HUASY"

Just in case.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: update comments for ibm devices at hwtable
Xose Vazquez Perez [Mon, 1 Aug 2016 20:28:47 +0000 (22:28 +0200)]
multipath-tools: update comments for ibm devices at hwtable

Identify devices and remove redundant label.

Cc: Hannes Reinecke <hare@suse.de>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: Remove ONTAP IBM Nseries from hwtable
Xose Vazquez Perez [Mon, 1 Aug 2016 20:09:37 +0000 (22:09 +0200)]
multipath-tools: Remove ONTAP IBM Nseries from hwtable

Originally from Martin George <marting@netapp.com>

He wrote:
"Even earlier, the NetApp IBM Nseries product line never used a
VID/PID of "IBM" & "Nseries" respectively. Instead, it always
used the same VID/PID of "NETAPP" & "LUN" itself, similar to the
ONTAP product line. So this piece of code was redundant from the
beginning itself."

Cc: Hannes Reinecke <hare@suse.de>
Cc: Martin George <marting@netapp.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: hwtable housekeeping 2016-08-01
Xose Vazquez Perez [Mon, 1 Aug 2016 20:06:32 +0000 (22:06 +0200)]
multipath-tools: hwtable housekeeping 2016-08-01

Mainly: arrange some families, clean redundant labels, add missing
vendor header and identify some devices.

No new devices added nor functional changes.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: remove -FAILBACK_IMMEDIATE from NEXENTA/COMSTAR
Xose Vazquez Perez [Mon, 1 Aug 2016 16:44:37 +0000 (18:44 +0200)]
multipath-tools: remove -FAILBACK_IMMEDIATE from NEXENTA/COMSTAR

Because there is no prio.

Cc: Yacine Kheddache <yacine@alyseo.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: change .pgpolicy and .pgfailback to default values in the template
Xose Vazquez Perez [Mon, 1 Aug 2016 15:31:51 +0000 (17:31 +0200)]
multipath-tools: change .pgpolicy and .pgfailback to default values in the template

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: Use ALUA for HP 3PAR
Xose Vazquez Perez [Mon, 1 Aug 2016 14:28:48 +0000 (16:28 +0200)]
multipath-tools: Use ALUA for HP 3PAR

Original patch from Hannes Reinecke <hare@suse.de>:

                .vendor        = "3PARdata",
                .product       = "VV",
                .features      = DEFAULT_FEATURES,
-               .hwhandler     = DEFAULT_HWHANDLER,
-               .pgpolicy      = MULTIBUS,
-               .pgfailback    = FAILBACK_UNDEF,
+               .hwhandler     = "1 alua",
+               .pgpolicy      = GROUP_BY_PRIO,
+               .pgfailback    = -FAILBACK_IMMEDIATE,
                .rr_weight     = RR_WEIGHT_NONE,
-               .no_path_retry = NO_PATH_RETRY_UNDEF,
-               .checker_name  = DEFAULT_CHECKER,
-               .prio_name     = DEFAULT_PRIO,
+               .no_path_retry = 18,
+               .checker_name  = TUR,
+               .prio_name     = PRIO_ALUA,
                .prio_args     = NULL,

Sebastian was not convinced with this change, full thread: https://marc.info/?t=146175638600002
But there is no automatic way to change .pgpolicy from MULTIBUS to GROUP_BY_PRIO.
So we should stick to latest manufacturer's recommendations:

"With 3PAR OS 3.1.3 or later, Hewlett Packard Enterprise recommends host persona
2 (ALUA). Advantages of Host Persona 2 (ALUA):
o A single VV migration can be performed by using 3PAR Peer Motion if the
  source and destination 3PAR StoreServ Storage array uses host persona 2
  (required by the 3PAR OS).
o Host persona 2 is required for Storage Federation (required by the 3PAR OS).

*3PAR plans to support additional features in later HPE 3PAR OS releases only at
  Generic-ALUA Persona 2

Persona_Number Persona_Name   Host_Operating_System       Additional_Capabilities
============== ============== ==========================  =======================
1              Generic        Linux, Windows and Solaris  UARepLun, SESLun
2              Generic-ALUA   Linux, Windows and Solaris  UARepLun, SESLun, ALUA
6              Generic-Legacy Linux, Windows and Solaris  None

o UARepLun -  Notifies the host of newly exported VLUNs and should trigger a LUN
              discovery request on the host, making the VLUN automatically
              available on format.
o SESLun   -  Enables iSCSI Enclosure Services (SES) LUN ID 254 for Host Explorer
              agent support.
o ALUA     -  Enables the Asymmetric Logical Unit Access (ALUA) command and
              asymmetric state change unit attention when path counts change
              due to adding or removing ports in the host's definition."

HPE 3PAR docs: http://www.hpe.com/info/storage/docs

Cc: Sebastian Herbszt <herbszt@gmx.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: Pillar/Axiom supports failback=immediate
Xose Vazquez Perez [Mon, 1 Aug 2016 14:18:56 +0000 (16:18 +0200)]
multipath-tools: Pillar/Axiom supports failback=immediate

ALUA device with support for preferred_path. Confirmed by
the vendor's utils and docs: https://docs.oracle.com/cd/E35311_02/E28846_08/E41503_01/conPathSelection.html
and also the vendor: https://marc.info/?l=dm-devel&m=147004019524938

Cc: Srinivasan Ramani <srinivas.ramani@oracle.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: delete nearly all attributes of the last member(NULL) in hwtable
Xose Vazquez Perez [Mon, 1 Aug 2016 14:11:19 +0000 (16:11 +0200)]
multipath-tools: delete nearly all attributes of the last member(NULL) in hwtable

They are "useless".
Leave only mandatory attributes.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: remove -FAILBACK_IMMEDIATE from devices with no prio
Xose Vazquez Perez [Mon, 1 Aug 2016 14:04:25 +0000 (16:04 +0200)]
multipath-tools: remove -FAILBACK_IMMEDIATE from devices with no prio

Changed to FAILBACK_UNDEF(manual).

Spotted by Hannes.

Cc: Hannes Reinecke <hare@suse.de>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agoRevert "multipathd: memory leak from orphan_path()"
Christophe Varoqui [Tue, 9 Aug 2016 14:34:47 +0000 (16:34 +0200)]
Revert "multipathd: memory leak from orphan_path()"

This reverts commit 44b753d34ff82ecc229407fe8247b11f15f435ce.

Gioh Kim found out that orphan_path() is not responsible for
the allocated memory pointed by pp->getuid, thus should not
free() it.

3 years agoFix wwn keyword of the weighted path prioritizer
Christophe Varoqui [Mon, 1 Aug 2016 16:07:28 +0000 (18:07 +0200)]
Fix wwn keyword of the weighted path prioritizer

Accidentaly broken by the serial keyword patch, as noted by Bart
Van Assche.

3 years agomultipath: add serial keyword to the weightedpath prioritizer
Christophe Varoqui [Sun, 31 Jul 2016 19:08:14 +0000 (21:08 +0200)]
multipath: add serial keyword to the weightedpath prioritizer

Allow the weightedpath prioritizer to set priority to paths to
specific serial numbers, expressed as regular expressions.

Example:

prio weightedpath
prio_args "serial .*101 30 .*102 10"

This feature is most synthetic for cross-site + all-paths-active
topologies, where servers on a site want to prefer paths to the
local storage heads.

3 years agoSwitch GROUP_BY_PRIO to MULTIBUS pgpolicy for devices without a prioritizer set
Christophe Varoqui [Mon, 1 Aug 2016 07:27:09 +0000 (09:27 +0200)]
Switch GROUP_BY_PRIO to MULTIBUS pgpolicy for devices without a prioritizer set

The GROUP_BY_PRIO pgpolicy with no prioritizer set actually apply
a multibus grouping as all paths inherit the same default priority.

Switch to the MULTIBUS pgpolicy in this case to avoid confusion.

Only EUROLOGC FC2502 is affected.

3 years agoRevert "multipath-tools: change default path_grouping_policy from failover to group_b...
Christophe Varoqui [Mon, 1 Aug 2016 07:19:54 +0000 (09:19 +0200)]
Revert "multipath-tools: change default path_grouping_policy from failover to group_by_prio"

Switch back to failover as the default path grouping policy.

Hannes reported:

'group_by_prio' requires a working prioritizer, which we cannot assume
for an unknown device.

3 years agomultipathd: Ensure that SIGINT, SIGTERM, SIGHUP and SIGUSR1 are delivered to the...
Bart Van Assche [Wed, 27 Jul 2016 21:14:08 +0000 (14:14 -0700)]
multipathd: Ensure that SIGINT, SIGTERM, SIGHUP and SIGUSR1 are delivered to the uxsock thread

The POSIX standard mentions that the only way to guarantee that signals
are delivered to a specific thread is:
* Block all signals before the first pthread_create() call.
* Unblock signals from the thread that should receive signals.

Implement that approach in multipathd. And since ppoll() can return 0
if interrupted, also call handle_signals() if ppoll() returns 0.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agomultipathd: Do not perform POSIX mutex operations inside a signal handler
Bart Van Assche [Wed, 27 Jul 2016 21:13:46 +0000 (14:13 -0700)]
multipathd: Do not perform POSIX mutex operations inside a signal handler

According to the POSIX standard, only functions that are async-signal-safe
may be invoked from inside a signal handler. The only POSIX thread functions
that are async-signal-safe are pthread_kill(), pthread_self() and
pthread_sigmask(). See also
http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_03.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agomultipathd: Fix type of rcu_unregister()
Bart Van Assche [Wed, 27 Jul 2016 21:13:25 +0000 (14:13 -0700)]
multipathd: Fix type of rcu_unregister()

This patch avoids that gcc reports the following compiler warning:

initialization from incompatible pointer type [-Wincompatible-pointer-types]
  pthread_cleanup_push(rcu_unregister, NULL);

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agolibmultipath: Fix spelling in a log message
Bart Van Assche [Wed, 27 Jul 2016 21:13:01 +0000 (14:13 -0700)]
libmultipath: Fix spelling in a log message

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agolibmultipath: Declare more functions 'static'
Bart Van Assche [Wed, 27 Jul 2016 21:12:44 +0000 (14:12 -0700)]
libmultipath: Declare more functions 'static'

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agoMinimize #include directives
Bart Van Assche [Wed, 27 Jul 2016 21:12:26 +0000 (14:12 -0700)]
Minimize #include directives

Remove unneeded #include directives. Correct the comments next to
the #include directives in multipathd/pidfile.c.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agolibmultipath:fix memory leak in path group policies
zhang.kai [Tue, 26 Jul 2016 10:09:03 +0000 (18:09 +0800)]
libmultipath:fix memory leak in path group policies

In the path group functions, memory leak would happen if the exceptional situation were met.

Signed-off-by: zhang.kai <zhang.kai16@zte.com.cn>
3 years agomultipath-tools: replace remaining leading spaces with tabs
Xose Vazquez Perez [Mon, 25 Jul 2016 23:10:03 +0000 (01:10 +0200)]
multipath-tools: replace remaining leading spaces with tabs

spotted by checkpatch.pl

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath: fix multipath -l <devmap> without output
Mauricio Faria de Oliveira [Mon, 25 Jul 2016 13:41:38 +0000 (10:41 -0300)]
multipath: fix multipath -l <devmap> without output

Currently, the multipath -l <devmap> output is empty, and an error
is printed to syslog:

    # ./multipath -l mpatha
    #

    # echo $?
    1

    # tail /var/log/messages
    ...
    ... multipath: mpatha: can't get udev device

That's due to dev_type not being initialized, and incorrectly evaluated.
So, initialize it to DEV_NONE, which is verified/reset by get_dev_type().

Now there's actual output and no error in syslog:

    # ./multipath -l mpatha
    mpatha (3600a0b800011e95c000055d855167d1c) dm-0 IBM,1815      FAStT
    ...

    # echo $?
    0

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
(tested on '2613ce0 Bump version code to 0.6.2')

3 years agomultipath-tools: replace leading spaces with tabs II
Xose Vazquez Perez [Sat, 23 Jul 2016 00:29:11 +0000 (02:29 +0200)]
multipath-tools: replace leading spaces with tabs II

Mainly replace less than 8 ^spaces with tabs where is required and remove
^space from goto labels.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: use parentheses() to cover a regex with pipe|
Xose Vazquez Perez [Sat, 23 Jul 2016 00:29:10 +0000 (02:29 +0200)]
multipath-tools: use parentheses() to cover a regex with pipe|

Easier to read, and maintain consistency with the rest.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: Clarify template rules of hwtable
Xose Vazquez Perez [Sat, 23 Jul 2016 00:29:09 +0000 (02:29 +0200)]
multipath-tools: Clarify template rules of hwtable

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: delete no_path_retry attribute when it is equal to default value
Xose Vazquez Perez [Sat, 23 Jul 2016 00:29:08 +0000 (02:29 +0200)]
multipath-tools: delete no_path_retry attribute when it is equal to default value

Defaul value is already 0 (NO_PATH_RETRY_UNDEF)

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agoRevert "multipath-tools: change default failback from manual to immediate"
Christophe Varoqui [Sun, 31 Jul 2016 08:40:55 +0000 (10:40 +0200)]
Revert "multipath-tools: change default failback from manual to immediate"

This reverts commit 5c418c1f38e6e766928ac634f6dcee44518c53bf.

Hannes reported:

'immediate' fallback only makes sense if the device has a working
prioritizer _and_ supports a 'preferred path'.
None of which can be assumed for an unknown device, so this patch
will break automatic configuration.

3 years agomultipathd: memory leak from orphan_path()
Gioh Kim [Fri, 22 Jul 2016 21:20:36 +0000 (23:20 +0200)]
multipathd: memory leak from orphan_path()

Hello,

I checked the memory consuming of the multipathd and found it consumes too
much memory.
Following is the result I have got from 6 servers.
Longer running multipathd consumes more memory.

# ps -eo user,pid,ppid,rss,size,vsize,pmem,pcpu,time,cmd --sort -rss | grep
multipath
root      2948     1  4376 66764  98572  0.0  0.0 00:00:01 /sbin/multipathd
root      3035     1  8648 71068 102876  0.0  0.1 00:09:11 /sbin/multipathd
root     39004     1 10236 137944 169752  0.0 0.1 03:20:43 /sbin/multipathd
root      3149     1 11976 139792 171600  0.0 0.2 05:37:37 /sbin/multipathd
root      3168     1 13792 76056 107864  0.0  0.3 07:04:41 /sbin/multipathd
root      3135     1 14920 142500 174308  0.0 0.4 08:49:38 /sbin/multipathd

So I did valgrind test with debian 0.4.9 version and I've got following
error.
pp->getuid is initialized by malloc but it is not freed.

==14958== 280 bytes in 4 blocks are definitely lost in loss record 2 of 3
==14958==    at 0x4C28C20: malloc (vg_replace_malloc.c:296)
==14958==    by 0x5702D2E: select_getuid (in /lib/libmultipath.so.0)
==14958==    by 0x56FFA0F: ??? (in /lib/libmultipath.so.0)
==14958==    by 0x5701707: pathinfo (in /lib/libmultipath.so.0)
==14958==    by 0x5701BDE: store_pathinfo (in /lib/libmultipath.so.0)
==14958==    by 0x5701F17: path_discovery (in /lib/libmultipath.so.0)
==14958==    by 0x407916: configure (main.c:1310)
==14958==    by 0x404B60: child (main.c:1623)
==14958==    by 0x404B60: main (main.c:1834)

Finally I've applied following patch.
The valgrind does not complain any more.
I checked the latest source but orphan_path() has no patch like that.
I'd appreciate if you would review my patch and give me any feedback.

------------------------- 8< ------------------

3 years agomultipathd: Correctly invalidate configuration during shutdown
Hannes Reinecke [Fri, 22 Jul 2016 11:04:25 +0000 (13:04 +0200)]
multipathd: Correctly invalidate configuration during shutdown

We still need to use rcu primitives when shutting down the system;
the original configuration might have become invalidated.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agoBump version code to 0.6.2 0.6.2
Christophe Varoqui [Fri, 22 Jul 2016 09:38:14 +0000 (11:38 +0200)]
Bump version code to 0.6.2

3 years agomultipath-tools: replace <wait.h> with <sys/wait.h>
Xose Vazquez Perez [Thu, 21 Jul 2016 22:01:15 +0000 (00:01 +0200)]
multipath-tools: replace <wait.h> with <sys/wait.h>

The standard place of wait.h is under /usr/include/sys/
Spotted by musl libc.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: replace <sys/poll.h> with <poll.h>
Xose Vazquez Perez [Thu, 21 Jul 2016 19:29:28 +0000 (21:29 +0200)]
multipath-tools: replace <sys/poll.h> with <poll.h>

The standard place of poll.h is in /usr/include/
Spotted by musl libc.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: memory.h is referred to the local header
Xose Vazquez Perez [Wed, 20 Jul 2016 13:15:49 +0000 (15:15 +0200)]
multipath-tools: memory.h is referred to the local header

It could be removed from these files because it's already included in
the hierarchy of the headers. As it's shown in the headers tree,
(multipathd/cli.c): https://drive.google.com/file/d/0B_B6YmEmO7cDeWVaMDViekRldW8

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: regex.h and errno.h are standard headers
Xose Vazquez Perez [Tue, 19 Jul 2016 20:54:35 +0000 (22:54 +0200)]
multipath-tools: regex.h and errno.h are standard headers

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: memory.h is a local header in libmultipath/checkers/emc_clariion.c
Xose Vazquez Perez [Tue, 19 Jul 2016 18:10:45 +0000 (20:10 +0200)]
multipath-tools: memory.h is a local header in libmultipath/checkers/emc_clariion.c

Added in 57a6c5c7.
But it could be removed because it's already included in "checkers.h"

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: memory.h is a local header in multipathd/uxclnt.c
Xose Vazquez Perez [Tue, 19 Jul 2016 17:53:45 +0000 (19:53 +0200)]
multipath-tools: memory.h is a local header in multipathd/uxclnt.c

If it is removed, the compiler warns: "undefined reference to `FREE'"

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: put a space between #include and the header file
Xose Vazquez Perez [Mon, 18 Jul 2016 14:58:14 +0000 (16:58 +0200)]
multipath-tools: put a space between #include and the header file

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agomultipath-tools: replace <> with "" for local headers
Xose Vazquez Perez [Mon, 18 Jul 2016 14:42:32 +0000 (16:42 +0200)]
multipath-tools: replace <> with "" for local headers

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 years agomultipath-tools: remove final \ in fprintf
Xose Vazquez Perez [Mon, 18 Jul 2016 13:23:59 +0000 (15:23 +0200)]
multipath-tools: remove final \ in fprintf

Useless.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: replace leading spaces with tabs
Xose Vazquez Perez [Mon, 18 Jul 2016 12:27:07 +0000 (14:27 +0200)]
multipath-tools: replace leading spaces with tabs

replace ^8x(1,2,3,4,5,6 and 7) spaces with tabs.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agoDocument the new detect_prio behaviour wrt sysfs alua files
Christophe Varoqui [Fri, 22 Jul 2016 09:23:57 +0000 (11:23 +0200)]
Document the new detect_prio behaviour wrt sysfs alua files

This part of Hannes patch needed rebasing.

3 years agomultipathd: fix memory leak in reconfigure()
tang.junhui [Mon, 18 Jul 2016 12:14:31 +0000 (20:14 +0800)]
multipathd: fix memory leak in reconfigure()

Problem:
Memory leak exists in reconfigure() when multipathd command reconfigure is executed.

Reasons:
 * The following judgment condition is not satisfied when there is no path,
   free_pathvec() is not called to free the vector of vecs->pathvec:
       if (VECTOR_SIZE(vecs->pathvec))
           free_pathvec(vecs->pathvec, FREE_PATHS);
 * Then the vecs->pathvec is set to NULL, so the vector memory which
   vecs->pathvec pointed to is leaked:
       vecs->pathvec = NULL;

Signed-off-by: tang.junhui <tang.junhui@zte.com.cn>
3 years agomultipathd: Add 'sysfs' prioritizer
Hannes Reinecke [Fri, 15 Jul 2016 06:48:57 +0000 (08:48 +0200)]
multipathd: Add 'sysfs' prioritizer

Recent kernels have an 'access_state' attribute which allows
us to read the asymmetric access state directly from sysfs.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoalua prioritizer: Fix typo 'perf'
Hannes Reinecke [Fri, 15 Jul 2016 06:48:56 +0000 (08:48 +0200)]
alua prioritizer: Fix typo 'perf'

The bit is called the 'preferred_path' bit. Nothing do to with
performance.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: call get_vpd_uid() if no uid_attribute is set
Hannes Reinecke [Fri, 15 Jul 2016 06:48:55 +0000 (08:48 +0200)]
libmultipath: call get_vpd_uid() if no uid_attribute is set

If the uid_attribute is unset we should be calling get_vpd_uid()
directly without waiting for retrigger udev events.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath:fix loop traversed partly
zhang.kai [Thu, 14 Jul 2016 12:09:33 +0000 (20:09 +0800)]
libmultipath:fix loop traversed partly

Problem:
With each iteration of the vector_foreach_slot() loop statement,
some slots couldn't be traversed when a slot is deleted from vector.

Reasons:
Currently,loop's index 'i' is not decremented correspondingly when a slot is
deleted from vector.Meanwhile, in the vector_foreach_slot() loop, mpp is assigned
from vector newmp directly, so find_slot() could be omitted.

Signed-off-by: zhang.kai <zhang.kai16@zte.com.cn>
3 years agokpartx: Fix check whether to detach loop device
Christian Kastner [Wed, 13 Jul 2016 17:23:02 +0000 (19:23 +0200)]
kpartx: Fix check whether to detach loop device

When invoking kpartx -d $FOO with $FOO being a regular file, the intention is
to also detach the loop device backing $FOO using del_loop(), but this
currently doesn't happen, as can be seen by calling losetup -a afterwards.

This is because the check for the type of $FOO, prior to the del_loop() call, is
broken. S_ISREG() is called on a buffer that initially did contain the status of
$FOO, but was later overwritten with the status of the backing loop device.

This replaces the S_ISREG() test with a check for whether the loop device path
is not NULL. If it isn't, then we know that it contains the correct path, and
del_loop() can be called safely on that.

Reported as Debian bug #829496; that bug also has more information.

Signed-off-by: Christian Kastner <ckk@kvr.at>
3 years agomultipath-tools: add template to add new hardware
Xose Vazquez Perez [Tue, 12 Jul 2016 14:41:47 +0000 (16:41 +0200)]
multipath-tools: add template to add new hardware

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: delete rr_weight attribute when it is equal to default value
Xose Vazquez Perez [Mon, 11 Jul 2016 21:42:47 +0000 (23:42 +0200)]
multipath-tools: delete rr_weight attribute when it is equal to default value

71                 .rr_weight     = RR_WEIGHT_NONE,

Defaul value is already RR_WEIGHT_NONE(uniform)

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: change default path_grouping_policy from failover to group_by_prio
Xose Vazquez Perez [Mon, 11 Jul 2016 21:12:02 +0000 (23:12 +0200)]
multipath-tools: change default path_grouping_policy from failover to group_by_prio

Default value is: failover
      5                 .pgpolicy      = GROUP_BY_SERIAL,
     23                 .pgpolicy      = MULTIBUS,
     48                 .pgpolicy      = GROUP_BY_PRIO,

failover is only used by 1 device:
IBM/3303 NVDISK

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: change default failback from manual to immediate
Xose Vazquez Perez [Mon, 11 Jul 2016 21:12:01 +0000 (23:12 +0200)]
multipath-tools: change default failback from manual to immediate

Default value is: manual
      1                 .pgfailback    = 15,
      2                 .pgfailback    = 30,
     24                 .pgfailback    = FAILBACK_UNDEF,
     50                 .pgfailback    = -FAILBACK_IMMEDIATE,

manual is not used by any device.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: order keywords in multipath.conf.5
Xose Vazquez Perez [Mon, 11 Jul 2016 21:05:17 +0000 (23:05 +0200)]
multipath-tools: order keywords in multipath.conf.5

Follow the same order as multipath output (libmultipath/dict.c)

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: Document retrigger_tries and retrigger_delay in multipath.conf.5
Xose Vazquez Perez [Mon, 11 Jul 2016 21:05:16 +0000 (23:05 +0200)]
multipath-tools: Document retrigger_tries and retrigger_delay in multipath.conf.5

Added in 688aa22bfa6efb1db0bd1fa6c4d5b6789eb1a911

Minimal info, a more detailed description should be nice.

Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: replace -shared with its variable
Xose Vazquez Perez [Sun, 10 Jul 2016 14:22:22 +0000 (16:22 +0200)]
multipath-tools: replace -shared with its variable

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: delete "$BUILD" from Makefile
Xose Vazquez Perez [Sun, 10 Jul 2016 12:40:40 +0000 (14:40 +0200)]
multipath-tools: delete "$BUILD" from Makefile

Useless.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: drop "BUILD = glibc" from libmpathpersist/Makefile
Xose Vazquez Perez [Sun, 10 Jul 2016 12:10:57 +0000 (14:10 +0200)]
multipath-tools: drop "BUILD = glibc" from libmpathpersist/Makefile

Useless.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>