multipath-tools/.git
2 weeks agoBump version to 0.7.2 master 0.7.2
Christophe Varoqui [Sat, 5 Aug 2017 06:35:36 +0000 (08:35 +0200)]
Bump version to 0.7.2

2 weeks agolibmultipath: update 3PARdata builtin config
Benjamin Marzinski [Mon, 26 Jun 2017 19:03:19 +0000 (14:03 -0500)]
libmultipath: update 3PARdata builtin config

This updated config comes from hp.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 weeks agomultipath-tools: fix format in multipath.conf.5
Xose Vazquez Perez [Fri, 4 Aug 2017 23:44:29 +0000 (01:44 +0200)]
multipath-tools: fix format in multipath.conf.5

multipath/multipath.conf.5:408: warning: can't find font `,'

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 weeks agomultipath-tools: beautify path_latency.c code
Xose Vazquez Perez [Thu, 22 Jun 2017 16:46:23 +0000 (18:46 +0200)]
multipath-tools: beautify path_latency.c code

Mainly running scripts/Lindent, from kernel dir, to replace indent spaces
by tabs.

Cc: Yang Feng <philip.yang@huawei.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 weeks agomultipath-tools: sync third-party headers with 3.13 upstream
Xose Vazquez Perez [Wed, 21 Jun 2017 12:26:39 +0000 (14:26 +0200)]
multipath-tools: sync third-party headers with 3.13 upstream

Cc: Bart Van Assche <bart.vanassche@sandisk.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 weeks agomultipath-tools: check sysfs path state for NVMe/NVMf
Guan Junxiong [Fri, 28 Jul 2017 01:28:43 +0000 (09:28 +0800)]
multipath-tools: check sysfs path state for NVMe/NVMf

The previous code of path_offline checking was only valid for SCSI
device. It returned PATH_UP for other devices and throwed path check-
ing to chekers. This patch supplements checking sysfs path state for
NVMe/NVMf devices. For example, if NVMe/NVMf path is reconnectting or
resetting, we return PATH_PENDING in order to skip current path check-
ing and reschedule path checking in the next tick as soon as possible.

Signed-off-by: Guan Junxiong <guanjunxiong@huawei.com>
2 weeks agomultipath-tools: add/change fujitsu arrays
Xose Vazquez Perez [Fri, 21 Jul 2017 19:06:31 +0000 (21:06 +0200)]
multipath-tools: add/change fujitsu arrays

E[234]000 are a/a asymmetric with alua support
E[68]000  are a/a symmetric

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 weeks agolibmultipath: fix over-long NVME WWIDs
Martin Wilck [Tue, 18 Jul 2017 07:29:16 +0000 (09:29 +0200)]
libmultipath: fix over-long NVME WWIDs

Fix for NVME wwids looking like this (line continuations inserted here
for readability):

nvme.0000-3163653363666438366239656630386200-\
4c696e75780000000000000000000000000000000000000000000000000000000000000000000000-\
00000002

which are encountered in some combinations of Linux NVME host and target,
where the 2nd field represents the serial number (SN) and the 3rd the
model number (MN).

The device mapper allows map names only up to 128 characters.
Strip the "00" sequences at the end of the serial and model field,
they are hex-encoded 0-bytes which are forbidden by the NVME spec
anyway.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Acked-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Guan Junxiong <guanjunxiong@huawei.com>
2 weeks agolibmultipath: only listen for uevents with DEVTYPE=disk
Martin Wilck [Tue, 18 Jul 2017 07:29:15 +0000 (09:29 +0200)]
libmultipath: only listen for uevents with DEVTYPE=disk

We are only interested in disks anyway. This saves us checking
for devtype in the uevent processing queue, and is more powerful
than the previous test in the dropped function
uevent_can_discard_by_devpath().

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: "Schremmer, Steven" <Steve.Schremmer@netapp.com>
Reviewed-by: Guan Junxiong <guanjunxiong@huawei.com>
2 weeks agolibmultipath: drop uevent_can_discard_by_devpath
Martin Wilck [Tue, 18 Jul 2017 07:29:14 +0000 (09:29 +0200)]
libmultipath: drop uevent_can_discard_by_devpath

This function is broken. Not all devices that matter for multipathd
follow the block/$DEVICE/$PARTITION convention (example: NVME)

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: "Schremmer, Steven" <Steve.Schremmer@netapp.com>
Reviewed-by: Guan Junxiong <guanjunxiong@huawei.com>
2 weeks agolibmultipath: get_udev_uid: make sure pp->wwid is 0-terminated
Martin Wilck [Tue, 18 Jul 2017 07:29:13 +0000 (09:29 +0200)]
libmultipath: get_udev_uid: make sure pp->wwid is 0-terminated

If the first WWID_LEN bytes of the uuid_attribute do not contain
a 0 byte, pp->wwid may end up not properly terminated. Fix it by
using strlcpy() rather than strncpy().

Signed-off-by: Martin Wilck <mwilck@suse.com>
Acked-by: Benjamin Marzinski <bmarzins@redhat.com>
2 weeks agomultipath-tools: add HPE MSA 2050/2052 to hwtable
Xose Vazquez Perez [Sat, 8 Jul 2017 11:45:19 +0000 (13:45 +0200)]
multipath-tools: add HPE MSA 2050/2052 to 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 weeks agomultipath-tools: add HPE StoreVirtual 3200 family to hwtable
Xose Vazquez Perez [Fri, 7 Jul 2017 13:55:45 +0000 (15:55 +0200)]
multipath-tools: add HPE StoreVirtual 3200 family to hwtable

It's a new LEFTHAND array.

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 weeks agolibmultipath: fix unit to seconds in log message for checker timeout
Martin Wilck [Tue, 27 Jun 2017 15:11:47 +0000 (17:11 +0200)]
libmultipath: fix unit to seconds in log message for checker timeout

checker_timeout is in seconds, not milliseconds, since 905281da
"Specify checker_timeout in seconds". Fix the log messages.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 weeks agomultipath-tools: delete libdmmp/docs/man directory in make clean
Xose Vazquez Perez [Sat, 24 Jun 2017 18:06:13 +0000 (20:06 +0200)]
multipath-tools: delete libdmmp/docs/man directory in make clean

CC: Gris Ge <fge@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 weeks agokpartx.rules: Fix syntax error in skip_kpartx code
Martin Wilck [Fri, 23 Jun 2017 21:57:40 +0000 (23:57 +0200)]
kpartx.rules: Fix syntax error in skip_kpartx code

Fixes: 22736419 "kpartx.rules: respect skip_kpartx flag"
Signed-off-by: Martin Wilck <mwilck@suse.com>
2 weeks agomultipath-tools: move up TEMPLATE in hwtable
Xose Vazquez Perez [Fri, 23 Jun 2017 21:13:51 +0000 (23:13 +0200)]
multipath-tools: move up TEMPLATE in hwtable

and the 'MD Series' comment to the right 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 weeks agolibmultipath: retain_attached_hw_handler obsolete with 4.3+
Martin Wilck [Thu, 22 Jun 2017 14:59:11 +0000 (16:59 +0200)]
libmultipath: retain_attached_hw_handler obsolete with 4.3+

Kernels 4.3 and newer (commit 1bab0de0 "dm-mpath, scsi_dh: don't
let dm detach device handlers") imply "retain_attached_hw_handler yes".

Clarify this in the propsel code, log messages, and documentation.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
2 weeks agolibmultipath: add deprecated warning for some features settings
Martin Wilck [Thu, 22 Jun 2017 14:59:10 +0000 (16:59 +0200)]
libmultipath: add deprecated warning for some features settings

The device-mapper features "queue_if_no_path" and
"retain_attached_hw_handler" should be set via the configuration
keywords "no_path_retry" and "retain_attached_hw_handler",
respectively, not via "features".
Print a warning if these "features" settings are encountered.

So far these "features" settings will only be ignored if the
respective other keyword is set, so in particular
'features "1 queue_if_no_path"' will still work as expected, but
cause the warning to be printed.

We should consider ignoring these completely in a future version.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
2 weeks agomultipath.conf.5: Remove ??? and other minor fixes
Martin Wilck [Thu, 22 Jun 2017 14:59:09 +0000 (16:59 +0200)]
multipath.conf.5: Remove ??? and other minor fixes

Remove the FIXME markers by filling in missing content,
and make some other minor fixes.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Acked-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
2 weeks agomultipath.conf.5: document no_path_retry vs. queue_if_no_path
Martin Wilck [Thu, 22 Jun 2017 14:59:08 +0000 (16:59 +0200)]
multipath.conf.5: document no_path_retry vs. queue_if_no_path

Clarify the documentation about option precedence.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Acked-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
2 weeks agolibmultipath: assemble_map: fix queue_if_no_path logic
Martin Wilck [Thu, 22 Jun 2017 14:59:07 +0000 (16:59 +0200)]
libmultipath: assemble_map: fix queue_if_no_path logic

It is wrong to remove the queue_if_no_path feature if no_path_retry
is unset. Rather, in this case the feature should neither be added
nor removed.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Acked-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
2 weeks agolibmultipath: merge_hwe: fix queue_if_no_path logic
Martin Wilck [Thu, 22 Jun 2017 14:59:06 +0000 (16:59 +0200)]
libmultipath: merge_hwe: fix queue_if_no_path logic

The logic applied here should match the logic in select_features().
This is achieved by calling reconcile_features_with_options().

Signed-off-by: Martin Wilck <mwilck@suse.com>
Acked-by: Benjamin Marzinski <bmarzins@redhat.com>
2 weeks agolibmultipath: clarify option conflicts for "features"
Martin Wilck [Thu, 22 Jun 2017 14:59:05 +0000 (16:59 +0200)]
libmultipath: clarify option conflicts for "features"

The "features" option in multipath.conf can possibly conflict
with "no_path_retry" and "retain_attached_hw_handler".

Currently, "no_path_retry" takes precedence, unless it is set to
"fail", in which case it's overridden by "queue_if_no_path".
This is odd, either "features" or "no_path_retry" should take
precedence.
No precedence rules are defined for "retain_attached_hw_handler".

Make this behavior more consistent by always giving precedence
to the explicit config file options, and improve logging.

Put this logic into a separate function, which can be used
from other places in the code.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
2 weeks agolibmultipath: add/remove_feature: use const char* for feature
Martin Wilck [Thu, 22 Jun 2017 14:59:04 +0000 (16:59 +0200)]
libmultipath: add/remove_feature: use const char* for feature

Change the argument type for the feature to add or remove to
const char*, making it possible to pass const strings without
warnings.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Acked-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
2 weeks agolibmultipath: load_config: skip setting unnecessary defaults
Martin Wilck [Thu, 22 Jun 2017 14:59:03 +0000 (16:59 +0200)]
libmultipath: load_config: skip setting unnecessary defaults

We have the logic for setting defaults for paths and maps
in propsel.c. By pre-setting conf values with defaults in
load_config(), we generate irritating log messages like
'features = "0" (setting: multipath.conf defaults/devices section)'
if multipath.conf doesn't contain a features setting at all.

For some config settings, we need to use declare_def_snprint_defint()
now to make sure "multipathd show config" prints all defaults correctly.
To avoid confusion, we don't do this for "max_sectors", because
multipathd leaves this untouched by default.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Acked-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
8 weeks agomultipath-tools: add limits.h to kpartx/lopart.c
Xose Vazquez Perez [Wed, 17 May 2017 23:58:44 +0000 (01:58 +0200)]
multipath-tools: add limits.h to kpartx/lopart.c

musl libc complains of
lopart.c:76:12: error: ‘PATH_MAX’ undeclared (first use in this function)

Cc: Martin Wilck <mwilck@suse.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>
8 weeks agomultipath-tools: Replace multipath configuration output
Xose Vazquez Perez [Tue, 18 Apr 2017 00:07:56 +0000 (02:07 +0200)]
multipath-tools: Replace multipath configuration output

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>
8 weeks agomultipath-tools: enable libdmmp installation in alternative directory
Martin Wilck [Mon, 15 May 2017 20:33:25 +0000 (22:33 +0200)]
multipath-tools: enable libdmmp installation in alternative directory

Introduce a new Makefile variable, usr_prefix, to be used for
libdmmp and the associated pkgconfig file.

Some distributions install those libraries which are  necessary
for booting (and mounting /usr) in a different location (/lib or
/lib64) than other libraries (/usr/lib or /usr/lib64). On such
distributions, installation to the different paths can be achieved
by setting "usr_prefix=/usr". This will affect only libdmmp at this
time, as all other libaries in the multipath-tools package may be
relevant for booting.

For distributions on which /lib and /lib64 are just symlinks to their
/usr counterparts, nothing changes.

Comments are welcome.

Signed-off-by: Martin Wilck <mwilck@suse.com>
8 weeks agomultipath-tools: delete vendor name HUASY for Huawei devices
Zou Ming [Sat, 20 May 2017 08:27:02 +0000 (08:27 +0000)]
multipath-tools: delete vendor name HUASY for Huawei devices

For product XSG1,HUASY is obsolete for Huawei devices,Only HUAWEI is the official vendor name.

8 weeks agomultipath-tools: replace hidden tabs by spaces in .vendor
Xose Vazquez Perez [Sat, 20 May 2017 13:29:52 +0000 (15:29 +0200)]
multipath-tools: replace hidden tabs by spaces in .vendor

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>
8 weeks agomultipath-tools: fix a format warning in multipathd.8
Xose Vazquez Perez [Fri, 26 May 2017 16:19:20 +0000 (18:19 +0200)]
multipath-tools: fix a format warning in multipathd.8

warning: macro `list' not defined

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>
8 weeks agompathpersist.8: add missing documentation for -K, -C, -l
Martin Wilck [Mon, 22 May 2017 22:16:43 +0000 (00:16 +0200)]
mpathpersist.8: add missing documentation for -K, -C, -l

Furthermore, add a reference to the sg_persist man page.

8 weeks agolibmultipath: lazy device-mapper initialization
Martin Wilck [Tue, 6 Jun 2017 19:33:11 +0000 (21:33 +0200)]
libmultipath: lazy device-mapper initialization

The multipath command fails early if libdevmapper and/or the
dm_multipath driver are not found. But some multipath operations
don't require device mapper, notably the path checking operations
called from udev rules during early boot.

This patch delays dm initialization until the first device-mapper
call, allowing such operations to succeed even if the dm_multipath
driver is not loaded yet.

This fixes the following problem: during system boot, the dm_multipath
driver is usually loaded via "ExecStartPre" from the multipathd service
file. But with commit d7188fcd, this service is started only after
udev settle and thus the modules are loaded too late for udev
rule processing, causing "multipath" invocations from udev rules to fail
and paths to be wrongly classified as non-multipath.

Fixes: d7188fcd "multipathd: start daemon after udev trigger"
Signed-off-by: Martin Wilck <mwilck@suse.com>
8 weeks agolibmpathpersist: use extern struct udev from main program
Martin Wilck [Sun, 26 Mar 2017 13:49:47 +0000 (15:49 +0200)]
libmpathpersist: use extern struct udev from main program

Use the global variable "udev" - the internal one is not
initialized, causing current libudev calls to fail.
In the main program "mpathpersist", use a globally visible
variable "udev" rather than a local variable in main().
This imitates the way the global variable "udev" is used
in multipath and multipathd.

Removed the "udev" parameter from mpath_lib_init() to
clarify that it isn't used.

Fixes: b87454988 "libmultipath: separate out 'udev' config entry"
Signed-off-by: Martin Wilck <mwilck@suse.com>
8 weeks agomultipath-tools: Prioritizer based on a latency algorithm
Yang Feng [Wed, 21 Jun 2017 09:40:34 +0000 (17:40 +0800)]
multipath-tools: Prioritizer based on a latency algorithm

libmultipath/prioritizers: Prioritizer for device mapper multipath,
where the corresponding priority values of specific paths are provided
by a latency algorithm on the logarithmic scale. And the latency algorithm
is dependent on the following arguments(io_num and base_num).
The principle of the algorithm is illustrated as follows:
1. By sending a certain number "io_num" of read IOs to the current
path continuously, the IOs' average latency can be calculated.
2. Max average latency value is 100s, and min value is 1us. According
to the average latency of each path and the "base_number" of logarithmic
scale, the priority "rc" of each path can be provided.

For example: If base_num=10, the paths will be grouped in priority groups
with path latency <=1us, (1us, 10us], (10us, 100us], (100us, 1ms], (1ms, 10ms],
(10ms, 100ms], (100ms, 1s], (1s, 10s], (10s, 100s], >100s. As follows:

       <=1us            (1us, 10us]      (10us, 100us]               >100s
|------------------|------------------|------------------|...|------------------|
|  priority rank 9 |  priority rank 8 |  priority rank 7 |...|  priority rank 0 |
|------------------|------------------|------------------|...|------------------|
       Priority Rank Partitioning

Signed-off-by: Yang Feng <philip.yang@huawei.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
8 weeks agomultipath: Fix a potential buffer overflow
Bart Van Assche [Tue, 13 Jun 2017 16:33:39 +0000 (09:33 -0700)]
multipath: Fix a potential buffer overflow

Avoid that gcc 7 reports the following warning:

cli_handlers.c:1340:18: warning: '%d' directive writing between 1 and 3 bytes into a region of size 2 [-Wformat-overflow=]
  sprintf(*reply,"%d",mpp->prflag);

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
8 weeks agolibmultipath/datacore: Remove dead code
Bart Van Assche [Tue, 13 Jun 2017 16:33:38 +0000 (09:33 -0700)]
libmultipath/datacore: Remove dead code

Remove those variables a value is assigned to but that are never
used. This patch avoids that gcc 7 reports the following warning:

datacore.c:98:22: warning: '
   ' directive output may be truncated writing 1 byte into a region of size between 0 and 8 [-Wformat-truncation=]
  snprintf(vendor, 8, "%.8s\n", inqBuffp + 8);

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
8 weeks agolibmultipath: Simplify assemble_map()
Bart Van Assche [Tue, 13 Jun 2017 16:33:37 +0000 (09:33 -0700)]
libmultipath: Simplify assemble_map()

Introduce a macro for appending formatted text to the output buffer.
Eliminate the local variables 'shift' and 'freechar'. Move the
code for freeing a temporary buffer to the end of the function.
Handle snprintf() conversion errors. This patch avoids that gcc 7
reports the following warning:

dmparser.c:137:20: warning: '__builtin_snprintf' output truncated before the last format character [-Wformat-truncation=]
  snprintf(p, 1, "\n");
                    ^

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
8 weeks agokpartx: Improve portability of set_loop()
Bart Van Assche [Tue, 13 Jun 2017 16:33:36 +0000 (09:33 -0700)]
kpartx: Improve portability of set_loop()

Because macros like __x86_64__ are not defined by the C standard
and because it is easy to convert the int2ptr() macro into
standard C, use (void*)(uintptr_t) instead of int2ptr(). Inline
this macro because it only has one user. This patch does not
change any functionality.

Reported-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Xose Vazquez Perez <xose.vazquez@gmail.com>
8 weeks agomultipathd: fix "show maps json" crash
Benjamin Marzinski [Fri, 2 Jun 2017 03:09:12 +0000 (22:09 -0500)]
multipathd: fix "show maps json" crash

If there are no multipath devices, show_maps_json sets the maximum size
of the reply buffer to 0. Having a size of 0 causes the calls to calloc
and realloc to behave in ways that the code isn't designed to handle,
leading to a double-free crash. Instead, show_maps_json should just
use the INITIAL_REPLY_LEN if there are no multipath devices.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 weeks agompath: skip device configs without vendor/product
Benjamin Marzinski [Fri, 2 Jun 2017 03:09:11 +0000 (22:09 -0500)]
mpath: skip device configs without vendor/product

Right now if multipath.conf includes a device configuration without a
vendor or product string, it will automatically be applied to all
devices, skipping all other configs entirely.  This is clearly wrong.
This patch makes sure that user added configs include vendor and
product strings

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 weeks agomultipath: set verbosity to default during config
Benjamin Marzinski [Fri, 2 Jun 2017 03:09:10 +0000 (22:09 -0500)]
multipath: set verbosity to default during config

condlog was setting the verbosity to 0 if there was no configuration.
This keeps multipath from printing warning messages about config file
problems that are found while loading the configuration. Instead, it
should use the default config level until it loads the configuration
to find the current value.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 weeks agolibmultipath: change how RADOS checker is enabled
Benjamin Marzinski [Fri, 2 Jun 2017 03:09:09 +0000 (22:09 -0500)]
libmultipath: change how RADOS checker is enabled

Instead of making the user call "make", "make install" and "make clean"
with ENABLE_RADOS set correctly, have the makefile check if
/usr/include/rados/librados.h exists, just like it checks if specific
functions exist in a file.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 weeks agolibmultipath: add comment about resuming
Benjamin Marzinski [Fri, 2 Jun 2017 03:09:08 +0000 (22:09 -0500)]
libmultipath: add comment about resuming

The reason for the second resume in my commit "libmultipath: fix
suspended devs from failed reloads" is not obvious from the multipath
code, so add a comment.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 months agompathpersist: fix one more crash possiblity
Benjamin Marzinski [Sat, 13 May 2017 05:44:58 +0000 (00:44 -0500)]
mpathpersist: fix one more crash possiblity

when mpathpersist goes to rollback reservations, it doesn't do a
rollback (and thus doesn't create a pthread) on paths that didn't
successfully create a reservation in the first place. It also doesn't
do any rollbacks at all if the last path in the multipath device was down,
which is completely broken. However it still tries to join these
non-existant pthreads, causing crashes.  To fix this, set the status to
-1 (now MPATH_PR_SKIP) on threadinfos that don't get rollbacks, and
remove the broken path state checking.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 months agoRemove a superfluous "extern" keyword
Bart Van Assche [Wed, 17 May 2017 15:43:09 +0000 (08:43 -0700)]
Remove a superfluous "extern" keyword

Since it is not necessary to use the "extern" keyword in front of
a function definition, remove that keyword.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 months agoMove the declaration of mpath_mx_alloc_len to a header file
Bart Van Assche [Wed, 17 May 2017 15:43:07 +0000 (08:43 -0700)]
Move the declaration of mpath_mx_alloc_len to a header file

This allows the compiler to verify consistency of declaration and
definition.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 months agoRemove mpath_reverse_8bytes_order()
Bart Van Assche [Wed, 17 May 2017 15:43:06 +0000 (08:43 -0700)]
Remove mpath_reverse_8bytes_order()

Since this function is not used, remove it.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 months agolibmpathpersist: Add two missing #include directives
Bart Van Assche [Wed, 17 May 2017 15:43:05 +0000 (08:43 -0700)]
libmpathpersist: Add two missing #include directives

Make sure that including mpathpr.h as the first header file does not
fail. Since mpath_updatepr.c defines functions declared in mpathpr.h,
include that header file in that .c file such that the compiler can
check consistency of the .h and the .c file.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 months agolibmultipath/configure.h: Add a forward declaration
Bart Van Assche [Wed, 17 May 2017 15:43:04 +0000 (08:43 -0700)]
libmultipath/configure.h: Add a forward declaration

This change avoids that the "#include "configure.h"" statements that
are added by the next patch trigger a compiler warning.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 months agoMakefile: Remove assignments to unused variables
Bart Van Assche [Wed, 17 May 2017 15:43:03 +0000 (08:43 -0700)]
Makefile: Remove assignments to unused variables

No multipath-tools source file or Makefile imports anything directly
from the kernel source tree. Hence remove the variables that refer to
the kernel tree.

Since the $(VERSION) Makefile macro is not used, remove it. Note:
the version number is defined as a macro in libmultipath/version.h.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
3 months agomultipath-tools: document uid_attribute for NVME devices
Xose Vazquez Perez [Thu, 11 May 2017 17:29:35 +0000 (19:29 +0200)]
multipath-tools: document uid_attribute for NVME 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 months agompath_persist: Don't join threads that don't exist
Benjamin Marzinski [Tue, 9 May 2017 16:57:05 +0000 (11:57 -0500)]
mpath_persist: Don't join threads that don't exist

There are a couple of places in the mpath_persist code that were calling
pthread join, even if the pthread_create call failed, and the thread id
was undefined. This can cause crashes, so don't do it.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 months agokpartx: fix device checks
Benjamin Marzinski [Tue, 9 May 2017 16:57:04 +0000 (11:57 -0500)]
kpartx: fix device checks

There are a number of issues in the the kpartx device checking code.
First, it accepts files that are neither regular files or a block device
nodes (you can run kpartx on character devices or directories, and it
will treat them as block devices). When trying to figure out the
basename of a device, the code returns garbage if the path doesn't
include a '/'. Finally, the set_delimiter code can access memory outside
of the string if an empty string is passed in.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 months agolibmultipath: fix suspended devs from failed reloads
Benjamin Marzinski [Tue, 9 May 2017 16:57:03 +0000 (11:57 -0500)]
libmultipath: fix suspended devs from failed reloads

When multipath reloads a device, it can either fail while loading the
new table or while resuming the device. If it fails while resuming the
device, the device can get stuck in the suspended state.  To fix this,
multipath needs to resume the device again so that it can continue using
the old table.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 months agolibmultipath: refactor calls to get dm device info
Benjamin Marzinski [Tue, 9 May 2017 16:57:02 +0000 (11:57 -0500)]
libmultipath: refactor calls to get dm device info

Multipath has a number of functions that all do basically the same
thing to get members of the dm_info structure. This just refactors them
to use common code to do it.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 months agomultipathd: force reload device on all resizes
Benjamin Marzinski [Tue, 9 May 2017 16:57:01 +0000 (11:57 -0500)]
multipathd: force reload device on all resizes

My previous patch missed setting force_udev_reload on resizes initiated
by

multipathd resize map <map>

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 months agolibmultipath: print alias with no_path_retry message
Benjamin Marzinski [Tue, 9 May 2017 16:57:00 +0000 (11:57 -0500)]
libmultipath: print alias with no_path_retry message

the "flush_on_last_del in progress" message in select_no_path_retry
should print the device alias.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 months agomultipath-tools: fix compilation with gcc < 4.9
Martin Wilck [Wed, 17 May 2017 15:24:46 +0000 (17:24 +0200)]
multipath-tools: fix compilation with gcc < 4.9

gcc supports -fstack-protector-strong since v4.9 only. Add a "poor man's
autoconf" test to check whether the option is supported on the given
build system.

Fixes: 596f51f3
"multipath-tools: Replace -fstack-protector with -fstack-protector-strong"

Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agolibmultipath: print.c: make sure lines are 0-terminated
Martin Wilck [Wed, 17 May 2017 15:24:45 +0000 (17:24 +0200)]
libmultipath: print.c: make sure lines are 0-terminated

Under certain conditions, the output of "multipath -ll" or
"multipathd show topology", or the multipathd logs, may
contain garbage characters. Fix that by making sure that
the strings are always properly zero-terminated.

While touching this code, substitute a function for the
complex ENDLINE macro.

Note 1: The way this is coded, the previously written
character is overwritten by the newline. That behavior is
unchanged by this patch. I didn't want to fuzz with the
carefully crafted print.c code more than necessary at
this point.

Note 2: The condition (c <= line + len - 1) is equivalent to
(TAIL >= 0). It should always hold the way ENDLINE is called
after PRINT and PAD in print.c, and is only added as an
additional safeguard, e.g. against future code changes.

Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agokpartx: include sys/sysmacros.h
Martin Wilck [Mon, 15 May 2017 15:37:22 +0000 (17:37 +0200)]
kpartx: include sys/sysmacros.h

Finish the work started in ea436715. Fixes a compilation warning.

Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agokpartx: find_loop_by_file: use sysfs
Martin Wilck [Mon, 15 May 2017 15:37:21 +0000 (17:37 +0200)]
kpartx: find_loop_by_file: use sysfs

Rather then searching through all of /dev, look up loop devices
in /sys/devices/virtual/block. This is cleaner and more robust
(/dev/loop$Xp$Y symlinks may confuse kpartx).

Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agokpartx: use absolute path for regular files
Martin Wilck [Mon, 15 May 2017 15:37:20 +0000 (17:37 +0200)]
kpartx: use absolute path for regular files

kpartx supports being called for a regular file, in which
case it assumes that it should set up a loop device or use
an existing one. Because the loopinfo.lo_name field contains
an absolute path, matching with existing loop devices fails
for relative paths. Matching by basename only would be unreliable.

Therefore, convert relative to absolute path for regular files.

Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agokpartx: use partition UUID for non-DM devices
Martin Wilck [Mon, 15 May 2017 15:37:19 +0000 (17:37 +0200)]
kpartx: use partition UUID for non-DM devices

For dm devices, kpartx uses an UUID check at partition removal
to make sure it only deletes partitions it previously created.
Non-DM parent devices such as loop devices don't generally have
a UUID.

Introduce a "fake" UUID for these devices to make sure kpartx
deletes only devices it had created previously. Otherwise kpartx
might e.g. delete LVM LVs that are inside a device it is trying
to delete partitions for. It seems to be wiser to make sure the
user delete these manually before running "kpartx -d".

With the fake UUID in place, we can re-introduce the UUID check
for non-DM device that was removed in the earlier patch
"kpartx: dm_remove_partmaps: support non-dm devices".

This disables also deletion of partition mappings created
by earlier versions of kpartx. If kpartx has been updated after
partition mappings were created, the "-f" flag can be used
to force delting these partitions, too.

Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agolibmultipath: don't treat multi-linear mappings as partitions
Martin Wilck [Mon, 15 May 2017 15:37:18 +0000 (17:37 +0200)]
libmultipath: don't treat multi-linear mappings as partitions

dm_type is used in libmultipath only to check whether a mapping
is "linear", with the intention to test if it represents a
"partition". This test returns TRUE also for mappings with
multiple targets, the first of which happens to be a linear
mapping into the target device. This is questionable, it's
hard to assign a "type" to such maps anyway.

Fix this by returning an error for multi-target maps.
This is analogous to the patch
"kpartx: don't treat multi-linear mappings as partitions".

Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agokpartx: don't treat multi-linear mappings as partitions
Martin Wilck [Mon, 15 May 2017 15:37:17 +0000 (17:37 +0200)]
kpartx: don't treat multi-linear mappings as partitions

kpartx -d treats any map that has a "linear" mapping into a
device as first target as a partition of this device.
This is wrong, because linear mappings may consist of
several pieces, combining multiple devices into one
(LVM logical volumes are an example of such a
mapping). Partitions have to be single-target mappings.

Fix this by returning an error in dm_type() if a map with
multiple targets is encountered. The "type" of a map with
two or more targets is a difficult concept, anyway.

test case:
truncate -s 1G test0 test1
losetup /dev/loop0 test0
losetup /dev/loop1 test1
dmsetup create <<EOF
0 1000000 linear 7:0 4096
1000000 1000000 linear 7:1 4096
EOF
kpartx -d /dev/loop0 -v

The map "join" should NOT be deleted.

Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agokpartx: dm_devn: return error for non-existent device
Martin Wilck [Mon, 15 May 2017 15:37:16 +0000 (17:37 +0200)]
kpartx: dm_devn: return error for non-existent device

For non-existent maps (ENXIO from ioctl()), dm_task_run and
dm_task_get_info return success. We need to check info.exists.

Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agokpartx: dm_remove_partmaps: support non-dm devices
Martin Wilck [Mon, 15 May 2017 15:37:15 +0000 (17:37 +0200)]
kpartx: dm_remove_partmaps: support non-dm devices

Commit  3d709241 improved partition removal, but broke support
for handling partitions of non-dm devices such as loop devices
or RAM disks.

This requires passing the dev_t of the device down to
do_foreach_partmap(). Doing so, there's little use in trying
to derive major/minor numbers from the "mapname" any more
(which actually is the device name for non-DM devices).
But we can use this to find out whether the device in question
is a dm device.

The test for UUID match doesn't work for non-DM devices (this
shall be improved in a later patch in this series).

The test for equal name of parent dev and partition is only valid
for dm devices. For non-dm devices such as loop, "/dev/mapper/loop0"
could, theoretically, be a partition of "/dev/loop0"
(and we don't want to rely on map names).

Fixes: 3d709241 "kpartx: sanitize delete partitions"
Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agokpartx: relax and improve UUID check in dm_compare_uuid
Martin Wilck [Mon, 15 May 2017 15:37:14 +0000 (17:37 +0200)]
kpartx: relax and improve UUID check in dm_compare_uuid

It is wrong to assume that UUIDs of parent devices always contain
"mpath". Fix that, and make the check for the kpartx-specific prefix
"part%d-" stricter and more explicit.

Moreover, avoid duplication of string constants and properly express
the dependencies of the various constants.

Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agokpartx: remove is_loop_device
Martin Wilck [Mon, 15 May 2017 15:37:13 +0000 (17:37 +0200)]
kpartx: remove is_loop_device

This function is not used any more.

Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agokpartx: remove "no_partitions" support
Martin Wilck [Mon, 15 May 2017 15:37:12 +0000 (17:37 +0200)]
kpartx: remove "no_partitions" support

The kernel does not support the "no_partitions" feature - remove it.
Distributions who want to keep support for this feature should
re-enable it with a distro-specific patch.

Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agokpartx: test-kpartx: new unit test program
Martin Wilck [Mon, 15 May 2017 15:37:11 +0000 (17:37 +0200)]
kpartx: test-kpartx: new unit test program

This is a unit test program for kpartx, in particular for deleting
partitions.

NOTE: This test program fails with current kpartx; full patch series
needed to make it work.

Signed-off-by: Martin Wilck <mwilck@suse.com>
3 months agolibmultipath: force udev reloads
Benjamin Marzinski [Mon, 24 Apr 2017 22:39:30 +0000 (17:39 -0500)]
libmultipath: force udev reloads

Now that the multipath udev rules try harder to not do lvm scans or
kpartx runs unnecessarily, multipath needs to make sure that these do
run when they are wanted.  This patch makes sure that when a device is
force reloaded, or changes size, the MPATH_UDEV_RELOAD_FLAG isn't set.
This allows lvm scanning and kpartx runs to happen on these uevents.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 months agokpartx: default to running in sync mode
Benjamin Marzinski [Mon, 24 Apr 2017 22:39:29 +0000 (17:39 -0500)]
kpartx: default to running in sync mode

When users run kpartx, they would naturally assume that when it
completes, the devices have been created. However, kpartx runs in async
mode by default.  This seems like it is likely to trip up users.  So,
switch the default to sync mode, add a -n option to enable async mode,
and set async mode when kpartx is called by the udev rules.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 months agolibmultipath: fix partition detection
Benjamin Marzinski [Mon, 24 Apr 2017 22:39:28 +0000 (17:39 -0500)]
libmultipath: fix partition detection

The do_foreach_partmaps code could incorrectly list a device as a
partition of another device, because of two issues.  First, the check to
compare the dm UUID of two devices would allow two partition devices to
match, or a partition device to match with itself, instead of only
having a partition device match with the multipath device that it
belongs to.  Second, the code to check if a multipath device's
major:minor appeared in a partition device's table only used strstr
to check of the existance of the major:minor string. This meant that
any device with a minor number that started with the same digits would
match. for instance, checking for "253:10" would also match "253:102".

This patch fixes these issues.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 months agomultipath: fix up position independent code
Benjamin Marzinski [Mon, 24 Apr 2017 22:39:27 +0000 (17:39 -0500)]
multipath: fix up position independent code

The multipath binaries were not being compiled as position independent
executables (PIE).  This code fixes that, and makes other minor code
hardening tweaks to make hardening-check happier.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 months agomultipath: Merge the DELL MD3xxx device configs
Benjamin Marzinski [Mon, 24 Apr 2017 22:39:26 +0000 (17:39 -0500)]
multipath: Merge the DELL MD3xxx device configs

All of the Dell MD3xxx configs are identical, so we can just use one
config for them.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
4 months agoBump version to 0.7.1 0.7.1
Christophe Varoqui [Fri, 14 Apr 2017 08:38:29 +0000 (10:38 +0200)]
Bump version to 0.7.1

4 months agolibmultipath: fix skip_kpartx support for removing maps
Martin Wilck [Thu, 13 Apr 2017 13:05:48 +0000 (15:05 +0200)]
libmultipath: fix skip_kpartx support for removing maps

Commit 79a05a4e inadvertently removed the code necessary
to support multipath maps without partitions, as introduced
in b73a34ea "libmultipath: add skip_kpartx option". Revert
this part of the commit, so that skip_kpartx works again.

Fixes: 79a05a4e libmultipath: move suspend logic to _dm_flush_map
Signed-off-by: Martin Wilck <mwilck@suse.com>
4 months agoRevert "multipathd: set timeout for CLI commands correctly"
Martin Wilck [Thu, 13 Apr 2017 13:11:21 +0000 (15:11 +0200)]
Revert "multipathd: set timeout for CLI commands correctly"

This reverts commit a002d124723cef3f2bb4fc33899d2613bdfe3924.

uxsock_timeout is in ms (argument to poll()), whereas
parse_cmd() uses the value to add to tv_sec in a struct timespec.
So the previous code was correct.

Signed-off-by: Martin Wilck <mwilck@suse.com>
4 months agolibmultipath/propsel: Do not select sysfs prioritizer for RDAC arrays
Hannes Reinecke [Thu, 13 Apr 2017 15:39:48 +0000 (17:39 +0200)]
libmultipath/propsel: Do not select sysfs prioritizer for RDAC arrays

Recent RDAC (NetApp E-Series) firmware implemented an internal load
balancer and switched to implicit ALUA.
Unfortunately the load balancer relies on periodic REPORT TARGET PORT
GROUPS from the host, so we cannot use the sysfs prioritizer here.

References: bsc#1004858

Signed-off-by: Hannes Reinecke <hare@suse.com>
4 months agomultipath-tools: replace multipath configuration output
Xose Vazquez Perez [Sat, 8 Apr 2017 13:30:42 +0000 (15:30 +0200)]
multipath-tools: replace multipath configuration output

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>
4 months agoBump the version code and date 0.7.0
Christophe Varoqui [Wed, 12 Apr 2017 07:33:16 +0000 (09:33 +0200)]
Bump the version code and date

The uevents merging code justifies the version second digit bump.

4 months agomultipath-tools: amend text from multipath/multipath.conf.5
Xose Vazquez Perez [Tue, 28 Mar 2017 21:37:12 +0000 (23:37 +0200)]
multipath-tools: amend text from multipath/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>
4 months agomultipath: fix segfault with disable_changed_wwids
Benjamin Marzinski [Fri, 7 Apr 2017 06:16:38 +0000 (01:16 -0500)]
multipath: fix segfault with disable_changed_wwids

When a path wwid changes, uev_update_path was dereferencing pp->mpp
without checking if it was NULL.

Cc: Shichangkuo <shi.changkuo@h3c.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
4 months agoRemove a trailing tab
Christophe Varoqui [Wed, 12 Apr 2017 07:24:01 +0000 (09:24 +0200)]
Remove a trailing tab

4 months agolibmultipath: don't set max_sectors_kb on reloads
Benjamin Marzinski [Fri, 7 Apr 2017 06:16:37 +0000 (01:16 -0500)]
libmultipath: don't set max_sectors_kb on reloads

Multipath was setting max_sectors_kb on the multipath device and all its
path devices both when the device was created, and when it was reloaded.
The problem with this is that while this would set max_sectors_kb on all
the devices under multipath, it couldn't set this on devices on top of
multipath.  This meant that if a user lowered max_sectors_kb on an
already existing multipath device with a LV on top of it, the LV could
send down IO that was too large for the new max_sectors_kb value,
because the LV was still using the old value.  The solution to this is
to only set max_sectors_kb to the configured value when the device is
originally created, not when it is later reloaded.  Since not all paths
may be present when the device is original created, on reloads multipath
still needs to make sure that the max_sectors_kb value on all the path
devices is the same as the value of the multipath device. But if this
value doesn't match the configuration value, that's o.k.

This means that the max_sectors_kb value for a multipath device won't
change after it have been initially created. All of the devices created
on top of the multipath device will inherit that value, and all of the
devices will use it all the way down, so IOs will never be mis-sized.

I also moved sysfs_set_max_sectors_kb to configure.c, since it is only
called from there, and it it makes use of static functions from there.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
4 months agomultipathd: allow devices to switch from RW to RO
Benjamin Marzinski [Fri, 7 Apr 2017 06:16:36 +0000 (01:16 -0500)]
multipathd: allow devices to switch from RW to RO

Whenever multipathd tries to reload a device, even if it's because a
path switched from read/write to read-only, it tries to load the device
read/write first, and then falls back to read-only. When device-mapper
sees that multipath is using the same devices in the same state in its
new table, it simply reuses the devices from the old table, instead of
closing and re-opening them. This means that multipath can successfully
reload the multipath device read/write, even if a path device has
switched to read-only.  To deal with this, multipathd now doesn't try to
reload a device read/write when it sees that a path device has switched
to read-only.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
4 months agomultipathd: drop lock before calling uev_add_path
Benjamin Marzinski [Fri, 7 Apr 2017 06:16:35 +0000 (01:16 -0500)]
multipathd: drop lock before calling uev_add_path

commit c6a18f4541d0a161e2f5fed8c67d9732bf512b37 made uev_update_path
call uev_add_path while holding the vecs lock, which is deadlocks, since
uev_add_path grabs the vecs lock itself.

Cc: Alban Browaeys <prahal@yahoo.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
4 months agolibdmmp: move libdmmp.pc install location
Benjamin Marzinski [Fri, 7 Apr 2017 06:16:34 +0000 (01:16 -0500)]
libdmmp: move libdmmp.pc install location

/usr/share/pkgconfig is for non-architecture specific modules, and
/usr/lib/pkgconfig is for architecture specific modules. libdmmp.pc is
architecture specific, so it belongs in /usr/lib/pkgconfig

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
4 months agomultipathd: don't call strlen on NULL variables
Benjamin Marzinski [Fri, 7 Apr 2017 06:16:33 +0000 (01:16 -0500)]
multipathd: don't call strlen on NULL variables

strlen has undefined results when passed a NULL variable, so don't do
it.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
4 months agolibdmmp: don't disconnect from multipathd twice
Benjamin Marzinski [Fri, 7 Apr 2017 06:16:32 +0000 (01:16 -0500)]
libdmmp: don't disconnect from multipathd twice

libdmmp already disconnects from multipathd at the end of the
dmmp_mpath_array_get, so it doesn't need to do it earlier in the
function as well.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
4 months agomultipath-tools: remove incdir from Makefiles
Benjamin Marzinski [Fri, 7 Apr 2017 06:16:31 +0000 (01:16 -0500)]
multipath-tools: remove incdir from Makefiles

Makefile.in defines both incdir and includedir, and they are both the
same. This patch removes incdir, and makes all the Makefiles use
includedir.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
4 months agolibdmmp: minor Makefile cleanup
Benjamin Marzinski [Fri, 7 Apr 2017 06:16:30 +0000 (01:16 -0500)]
libdmmp: minor Makefile cleanup

This patch deletes the "/" after $(DESTDIR) and removes
libdmmp_speed_test on 'make clean'

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
4 months agoRevert "multipath-tools: arrange compilation options for binaries"
Christophe Varoqui [Thu, 23 Mar 2017 09:07:44 +0000 (10:07 +0100)]
Revert "multipath-tools: arrange compilation options for binaries"

This reverts commit 324c3b960f361e2433874e5ed7f8f9125cce0b97.

If object or library AA needs a symbol from library BB, then AA
should come before library BB in the command-line invocation of the linker.

4 months agoRevert "multipath-tools: arrange compilation options for shared libs/objects"
Christophe Varoqui [Thu, 23 Mar 2017 09:07:09 +0000 (10:07 +0100)]
Revert "multipath-tools: arrange compilation options for shared libs/objects"

This reverts commit 2601add472837f9d0ba93271ac84c1ec8b4b4c43.

If object or library AA needs a symbol from library BB, then AA
should come before library BB in the command-line invocation of the linker.

4 months agomultipath-tools: arrange compilation options for shared libs/objects
Xose Vazquez Perez [Sat, 18 Mar 2017 17:45:00 +0000 (18:45 +0100)]
multipath-tools: arrange compilation options for shared libs/objects

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>
4 months agomultipath-tools: arrange compilation options for binaries
Xose Vazquez Perez [Fri, 17 Mar 2017 22:40:02 +0000 (23:40 +0100)]
multipath-tools: arrange compilation options for binaries

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>
4 months agomultipath-tools: build objects for libdmmp and libmpathpersist independently
Xose Vazquez Perez [Fri, 17 Mar 2017 15:21:46 +0000 (16:21 +0100)]
multipath-tools: build objects for libdmmp and libmpathpersist independently

libdmmp:
cc -c -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int -Werror=implicit-function-declaration -Werror=format-security -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -I../libmultipath -I../libmpathpersist -I../libmpathcmd *.c
new:
cc -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int -Werror=implicit-function-declaration -Werror=format-security -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -I../libmultipath -I../libmpathpersist -I../libmpathcmd -c -o mpath_persist.o mpath_persist.c
cc -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int -Werror=implicit-function-declaration -Werror=format-security -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -I../libmultipath -I../libmpathpersist -I../libmpathcmd -c -o mpath_updatepr.o mpath_updatepr.c
cc -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int -Werror=implicit-function-declaration -Werror=format-security -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -I../libmultipath -I../libmpathpersist -I../libmpathcmd -c -o mpath_pr_ioctl.o mpath_pr_ioctl.c

libmpathpersist:
cc -c -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int -Werror=implicit-function-declaration -Werror=format-security -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -fvisibility=hidden -I../libdmmp -I../libmpathcmd -I/usr/include/json-c -c *.c
new:
cc -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int -Werror=implicit-function-declaration -Werror=format-security -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -fvisibility=hidden -I../libdmmp -I../libmpathcmd -I/usr/include/json-c -c -o libdmmp.o libdmmp.c
cc -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int -Werror=implicit-function-declaration -Werror=format-security -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -fvisibility=hidden -I../libdmmp -I../libmpathcmd -I/usr/include/json-c -c -o libdmmp_mp.o libdmmp_mp.c
cc -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int -Werror=implicit-function-declaration -Werror=format-security -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -fvisibility=hidden -I../libdmmp -I../libmpathcmd -I/usr/include/json-c -c -o libdmmp_pg.o libdmmp_pg.c
cc -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int -Werror=implicit-function-declaration -Werror=format-security -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -fvisibility=hidden -I../libdmmp -I../libmpathcmd -I/usr/include/json-c -c -o libdmmp_path.o libdmmp_path.c
cc -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int -Werror=implicit-function-declaration -Werror=format-security -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -fvisibility=hidden -I../libdmmp -I../libmpathcmd -I/usr/include/json-c -c -o libdmmp_misc.o libdmmp_misc.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>