multipath-tools/.git
2 years agoBump version to 0.6.3 0.6.3
Christophe Varoqui [Tue, 16 Aug 2016 07:36:45 +0000 (09:36 +0200)]
Bump version to 0.6.3

2 years agomultipath-tools: modify product regex in HDS devices
Xose Vazquez Perez [Thu, 11 Aug 2016 18:33:38 +0000 (20:33 +0200)]
multipath-tools: modify product regex in HDS devices

regex for product="DF" is tooooo wide.
Also changed for VSP to "^OPEN-"

I asked Matthias before make this change.

Cc: Matthias Rudolph <Matthias.Rudolph@hds.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>
2 years agomultipath-tools: move code up in Makefile
Xose Vazquez Perez [Thu, 11 Aug 2016 18:33:37 +0000 (20:33 +0200)]
multipath-tools: move code up in Makefile

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>
2 years agomultipath-tools: delete failback from IBM/2810XIV
Xose Vazquez Perez [Thu, 11 Aug 2016 18:32:25 +0000 (20:32 +0200)]
multipath-tools: delete failback from IBM/2810XIV

nonsense with multibus as path_grouping_policy

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>
2 years agomultipath-tools: add KOVE/XPD to hwtable
Xose Vazquez Perez [Thu, 11 Aug 2016 18:32:24 +0000 (20:32 +0200)]
multipath-tools: add KOVE/XPD to hwtable

Info provided directly by the manufacturer: http://kove.net/xpd

Cc: Nick Russo <nick.russo@kove.net>
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>
2 years agomultipath-tools: move DEFAULT_PRIO DEFAULT_PRIO_ARGS and DEFAULT_CHECKER to libmultip...
Xose Vazquez Perez [Thu, 11 Aug 2016 18:32:23 +0000 (20:32 +0200)]
multipath-tools: move DEFAULT_PRIO DEFAULT_PRIO_ARGS and DEFAULT_CHECKER to libmultipath/defaults.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>
2 years agomultipath-tools: request to update man pages if the code is changed
Xose Vazquez Perez [Thu, 11 Aug 2016 18:32:22 +0000 (20:32 +0200)]
multipath-tools: request to update man pages if the code is changed

Please, document the 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>
2 years agomultipath-tools: delete IBM/1745 ghost array
Xose Vazquez Perez [Thu, 11 Aug 2016 18:32:21 +0000 (20:32 +0200)]
multipath-tools: delete IBM/1745 ghost array

There is no references nowhere.
Confirmed by the original manufacturer(NetApp), and Google shows no results.

Cc: Sean Stewart <Sean.Stewart@netapp.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>
2 years agomultipath-tools: Edward Goggin no longer works at EMC
Xose Vazquez Perez [Thu, 11 Aug 2016 18:32:20 +0000 (20:32 +0200)]
multipath-tools: Edward Goggin no longer works at EMC

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>
2 years agomultipath-tools: Makefiles housekeeping
Xose Vazquez Perez [Thu, 11 Aug 2016 18:32:19 +0000 (20:32 +0200)]
multipath-tools: Makefiles housekeeping

Apart of this relevant change in libmpathpersist/Makefile
-       $(CC) -Wall -fPIC -c $(CFLAGS) *.c
+       $(CC) -c $(CFLAGS) *.c

Mainly indent and order code.

Compiled tested, also installed and uninstalled.

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>
2 years agomultipath-tools: minor edit of multipath/multipath.conf.5
Xose Vazquez Perez [Thu, 11 Aug 2016 18:32:18 +0000 (20:32 +0200)]
multipath-tools: minor edit of multipath/multipath.conf.5

Split long lines, and change a text from place.

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>
2 years agomultipath-tools: document the relation between queue_if_no_path and no_path_retry
Xose Vazquez Perez [Wed, 10 Aug 2016 16:20:38 +0000 (18:20 +0200)]
multipath-tools: document the relation between queue_if_no_path and no_path_retry

Also mark queue_if_no_path as deprecated.

Cc: Hannes Reinecke <hare@suse.de>
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>
2 years agomultipath-tools: document vendor, product, revision and bl_product are POSIX Extended...
Xose Vazquez Perez [Wed, 10 Aug 2016 16:20:36 +0000 (18:20 +0200)]
multipath-tools: document vendor, product, revision and bl_product are POSIX Extended regex

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>
2 years agomultipath-tools: remove patchwork reference
Xose Vazquez Perez [Wed, 10 Aug 2016 16:20:35 +0000 (18:20 +0200)]
multipath-tools: remove patchwork reference

It is only for kernel dm patches.

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>
2 years agomultipath-tools: add IBM/1813 - DCS3860 to hwtable
Xose Vazquez Perez [Wed, 10 Aug 2016 16:20:34 +0000 (18:20 +0200)]
multipath-tools: add IBM/1813 - DCS3860 to hwtable

It's a RDAC device, confirmed by the original manufacturer(NetApp).

Cc: Sean Stewart <Sean.Stewart@netapp.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>
2 years agomultipath-tools: standardize all RDAC devices
Xose Vazquez Perez [Wed, 10 Aug 2016 16:20:32 +0000 (18:20 +0200)]
multipath-tools: standardize all RDAC devices

This is a combo patch.

Reorder keyworks as in code and manpage for "(NETAPP|LSI|ENGENIO)"/"INF-01-00",
and clone its configuration to ALL other RDAC devices.

There are only two differences in all rdac devices. And they look minor:
.features and .no_path_retry

 devices                keyword          values
 =======                ==============   ====================
      3                 .features      = "1 queue_if_no_path",

      5                 .no_path_retry = 15,
      1                 .no_path_retry = 30,
      3                 .no_path_retry = 300,
     10                 .no_path_retry = NO_PATH_RETRY_QUEUE,

"queue_if_no_path" is identical to the "no_path_retry" keyword.
So "queue_if_no_path" can be replaced by "no_path_retry = XX"

And there are just six devices with:
      6                 .features      = "2 pg_init_retries 50",

Sean Stewart, from NetApp, provided more detailed information:

"The pg_init_retries value should be good for all RDAC devices, and can be
synced, the no_path_retry should also be fine. I don’t think that there’s
necessarily an “ideal” value for it, and may be more of a user preference type
of thing, but I personally don’t see anything wrong with having that value on
all RDAC devices, as well. It’s easy enough to change in the conf file if an end
user needs a different value."

I think the pg_init_retries parameter is set as such because part of
scsi_dh_rdac’s path activation involves sending a Mode Select page 0x2C to
change the ownership. If the array is already processing one, it will return
with a vendor unique check condition (05/91/36), which returns SCSI_DH_RETRY."

As for the no_path_retry, we’ve seen scenarios where both paths can be
temporarily unavailable during a storage firmware upgrade, usually because udev
processing has not added the path from one controller before the path from the
second controller goes away. This is just to give it some time to settle in
cases like that, so I/O can continue. The value of 30 was suggested by my
predecessor, but I think is largely arbitrary."

Cc: Sean Stewart <Sean.Stewart@netapp.com>
Cc: Benjamin Marzinski <bmarzins@redhat.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>
2 years agomultipath-tools: remove blank line at multipath.conf.5
Xose Vazquez Perez [Wed, 10 Aug 2016 16:20:31 +0000 (18:20 +0200)]
multipath-tools: remove blank line 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>
2 years agomultipath-tools: add Oracle FS to hwtable
Xose Vazquez Perez [Wed, 10 Aug 2016 16:20:30 +0000 (18:20 +0200)]
multipath-tools: add Oracle FS to hwtable

Based on info from the manufacturer.
And also add ^ to Axiom.

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>
2 years agomultipath-tools: SGI/TP9300 is a RDAC array
Xose Vazquez Perez [Wed, 10 Aug 2016 16:20:29 +0000 (18:20 +0200)]
multipath-tools: SGI/TP9300 is a RDAC array

Confirmed by the original manufacturer(NetApp).

Cc: Sean Stewart <Sean.Stewart@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>
2 years agomultipath-tools: replace "." for real values in (COMPAQ|HP)/"(MSA|HSV)1.0"
Xose Vazquez Perez [Wed, 10 Aug 2016 16:20:28 +0000 (18:20 +0200)]
multipath-tools: replace "." for real values in (COMPAQ|HP)/"(MSA|HSV)1.0"

Exact devices are in drivers/scsi/scsi_dh.c

        {"COMPAQ", "MSA1000 VOLUME",    "hp_sw" },
        {"COMPAQ", "HSV110",            "hp_sw" },
        {"HP",     "HSV100",            "hp_sw"},

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>
2 years agomultipath-tools: replace spaces with a regex in IBM/"3303 NVDISK"
Xose Vazquez Perez [Wed, 10 Aug 2016 16:20:27 +0000 (18:20 +0200)]
multipath-tools: replace spaces with a regex in IBM/"3303 NVDISK"

Replace six spaces with any number of them.
Exact regex is "3303[ ]{6,6}NVDISK", but it looks too overloaded.

Tested with a regex checker from:
http://eli.thegreenplace.net/2012/11/14/some-notes-on-posix-regular-expressions

Cc: Brian King <brking@linux.vnet.ibm.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>
2 years agomultipath-tools: replace (|) with [] when there is one element
Xose Vazquez Perez [Wed, 10 Aug 2016 16:20:26 +0000 (18:20 +0200)]
multipath-tools: replace (|) with [] when there is one element

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>
2 years agomultipath-tools: remove pgpolicy=FAILOVER from Ceph/RBD
Xose Vazquez Perez [Wed, 10 Aug 2016 16:20:25 +0000 (18:20 +0200)]
multipath-tools: remove pgpolicy=FAILOVER from Ceph/RBD

It's already the default pgpolicy.

Cc: Mike Christie <mchristi@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>
2 years agomultipath-tools: identify more devices at hwtable
Xose Vazquez Perez [Wed, 10 Aug 2016 16:20:24 +0000 (18:20 +0200)]
multipath-tools: identify more devices at 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>
2 years agomultipath-tools: add support for all IBM Enterprise Storage Server / Shark family
Xose Vazquez Perez [Thu, 11 Aug 2016 18:32:17 +0000 (20:32 +0200)]
multipath-tools: add support for all IBM Enterprise Storage Server / Shark family

Only F20 and 800 were included:
2105F20 IBM Enterprise Storage Server Model F20
2105800 IBM TotalStorage Enterprise Storage Server Model 800

Added all of them with just "^2105"
2105E10 IBM Enterprise Storage Server Model E10
2105E20 IBM Enterprise Storage Server Model E20
2105F10 IBM Enterprise Storage Server Model F10
2105750 IBM TotalStorage Enterprise Storage Server Model 750

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>
2 years agolibmultipath: fix memory API logic error
tang.junhui [Tue, 16 Aug 2016 01:55:32 +0000 (09:55 +0800)]
libmultipath: fix memory API logic error

Memroy API use mem_allocated to record the total size of used memory,
however, it's wrong to use size(p) as the length of freed memory in xfree(),
and memory may also be allocated by STRDUP() or REALLOC(), which is
not calculated into mem_allocated, so the total size of used memory is
not correctly. For these reasons, we removed these incorrectly code to keep
the code clean.

Signed-off-by: tang.junhui <tang.junhui@zte.com.cn>
2 years agolibmultipath: retry to get path serial number by get_serial() after failure by get_vp...
tang.junhui [Fri, 12 Aug 2016 03:43:56 +0000 (11:43 +0800)]
libmultipath: retry to get path serial number by get_serial() after failure by get_vpd_sysfs()

Some operating systems have no such file vpd_pg80 in sys directory
such as /sys/devices/platform/host23/session21/target23:0:0/23:0:0:33/,
so path serial number would be failed to get by get_vpd_sysfs(),
we need retry to get it by get_serial to avoid empty serial of the path.

Signed-off-by: tang.junhui <tang.junhui@zte.com.cn>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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.

2 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.

2 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.

2 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.

2 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.

2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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')

2 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>
2 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>
2 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>
2 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>
2 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.

2 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< ------------------

2 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>