multipath-tools/.git
22 months agokpartx: Use absolute paths to create mappings
Stef Walter [Sat, 6 Oct 2018 07:38:56 +0000 (09:38 +0200)]
kpartx: Use absolute paths to create mappings

kpartx -d now uses absolute paths to delete mappings, since the
commit 9bdfa3eb8e24b668e6c2bb882cddb0ccfe23ed5b. We should use
those same absolute paths to create the mappings.

Without this patch, the following workflow (as seen in the
manual page for kpartx) fails to actually remove the devices:

    # kpartx -av disk.img
    ...
    # kpartx -d disk.img

22 months agomultipath-tools: sync third-party headers with valgrind-3.14
Xose Vazquez Perez [Tue, 9 Oct 2018 22:37:14 +0000 (00:37 +0200)]
multipath-tools: sync third-party headers with valgrind-3.14

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEV ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
22 months agolibmultipath: fix gcc 8.1 "truncated output" warnings
Martin Wilck [Mon, 8 Oct 2018 09:38:21 +0000 (11:38 +0200)]
libmultipath: fix gcc 8.1 "truncated output" warnings

gcc 8.1 was warning about a possibly truncated output in snprintf.

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months ago(lib)mpathpersist: use O_RDONLY file descriptors
Martin Wilck [Mon, 8 Oct 2018 09:38:20 +0000 (11:38 +0200)]
(lib)mpathpersist: use O_RDONLY file descriptors

udevd catches close-after-write inotify events and generates "change"
uvents for such devices, which may cause extra unnecessary and unwanted
udev activity.

Therefore use O_RDONLY file descriptors for PRIN and PROUT commands. This
works just as well as O_WRONLY. sg_persist has supported the --readonly option
for years.

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agolibmpathpersist: fix byte swapping for big endian systems
Martin Wilck [Mon, 8 Oct 2018 09:38:19 +0000 (11:38 +0200)]
libmpathpersist: fix byte swapping for big endian systems

The functions "mpath_reverse_uintXY_byteorder"  were apparently meant to
convert BE integers to native. This leads to wrong results on big-endian
systems. Make these functions use the get_unaligned_beXY API, and rename.

Also, remove the unused endianness test in mpath_pr_ioctl.c.

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agomultipath-tools/tests: add tests for get_unaligned_beXX
Martin Wilck [Mon, 8 Oct 2018 09:38:18 +0000 (11:38 +0200)]
multipath-tools/tests: add tests for get_unaligned_beXX

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agolibmultipath: add (get|put)_unaligned_be64
Martin Wilck [Mon, 8 Oct 2018 09:38:17 +0000 (11:38 +0200)]
libmultipath: add (get|put)_unaligned_be64

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agolibmpathpersist: fix stack overflow in mpath_format_readfullstatus()
Martin Wilck [Mon, 8 Oct 2018 09:38:16 +0000 (11:38 +0200)]
libmpathpersist: fix stack overflow in mpath_format_readfullstatus()

Some storage arrays return corrupt data in response to READ FULL STATUS
PRIN commands. This may lead to stack overflow if the values aren't
sanitized.

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agolibmpathpersist: fix typo in mpath_format_readfullstatus
Martin Wilck [Mon, 8 Oct 2018 09:38:15 +0000 (11:38 +0200)]
libmpathpersist: fix typo in mpath_format_readfullstatus

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agolibmpathpersist: remove duplicate test in readfullstatus
Martin Wilck [Mon, 8 Oct 2018 09:38:14 +0000 (11:38 +0200)]
libmpathpersist: remove duplicate test in readfullstatus

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agomultipath-tools: refresh kernel-doc from kernel sources
Xose Vazquez Perez [Sat, 18 Aug 2018 20:38:52 +0000 (22:38 +0200)]
multipath-tools: refresh kernel-doc from kernel sources

Cc: Gris Ge <fge@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEV ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
22 months agomultipath-tools: tests/hwtable: test hidden devices
Martin Wilck [Tue, 2 Oct 2018 18:47:01 +0000 (20:47 +0200)]
multipath-tools: tests/hwtable: test hidden devices

Add a test for skipping "hidden" devices.

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agomultipath/tests: fix hwtable tests after "hidden" support
Martin Wilck [Tue, 2 Oct 2018 18:47:00 +0000 (20:47 +0200)]
multipath/tests: fix hwtable tests after "hidden" support

The previous patch "libmultipath: pathinfo: skip hidden devices"
requires a change in the pathinfo mocking code. Otherwise the hwtable
tests will fail.

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agomultipathd: try SCSI persistent reservations for SCSI only
Martin Wilck [Mon, 1 Oct 2018 18:45:07 +0000 (20:45 +0200)]
multipathd: try SCSI persistent reservations for SCSI only

This avoids error messages when PERSISTENT RESERVE IN ioctls
are tried on non-SCSI devices.

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agolibmultipath: allow sysfs_pathinfo to return SKIPPED
Martin Wilck [Mon, 1 Oct 2018 18:45:06 +0000 (20:45 +0200)]
libmultipath: allow sysfs_pathinfo to return SKIPPED

The sysfs_pathinfo() code path can't distinguish between real
failure and a devices that have to be skipped. One example
for this are NVMe native multipath devices. This may cause
lots of irritating log messages.

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agomultipathd: decrease log level of uevent messages
Martin Wilck [Fri, 14 Sep 2018 12:51:03 +0000 (14:51 +0200)]
multipathd: decrease log level of uevent messages

The messages "multipathd: add path (uevent)" etc. are displayed
frequently, and often for devices that don't matter for multipathd.
If real action needs to be taken, such as adding or removing paths
or maps from the internal structures, multipathd emits other log
messages at level 2 later on.

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agomultipathd: fix version check for DM_DEV_ARM_POLL ioctl
Martin Wilck [Fri, 14 Sep 2018 12:51:02 +0000 (14:51 +0200)]
multipathd: fix version check for DM_DEV_ARM_POLL ioctl

Make sure the checks in dmevent_poll_supported() and
arm_dm_event_poll() use the same logic. Currently, the
version check check fails in arm_dm_event_poll() if
libdevmapper's DM_VERSION is newer than the kernel's.

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agolibmultipath: pathinfo: skip hidden devices
Martin Wilck [Fri, 14 Sep 2018 12:51:01 +0000 (14:51 +0200)]
libmultipath: pathinfo: skip hidden devices

Hidden block devices (in practice: members of nvme native multipath
devices) can't be used by multipath anyway. Current multipath code
(with default blacklisting) skips them, too, but emits a misleading
"blacklisted: udev property missing" message.

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agolibmultipath: nvme: shorter topology output
Martin Wilck [Fri, 14 Sep 2018 12:51:00 +0000 (14:51 +0200)]
libmultipath: nvme: shorter topology output

The nvme foreign code maps the NVMe subsys NQN to the "%n"
wildcard ("alias"). Some real-world devices use very lengthy
expressions for the subsys NQN (counted 95 characters on one
system here), making the "multipath -ll" output hardly readable
for humans. Use a shorter and more concise printout instead,
based on the WWID only.

The subsys NQN is still available via the "%n" wildcard:
"multipathd show maps format %n".

Signed-off-by: Martin Wilck <mwilck@suse.com>
22 months agolibmultipath: nvme: fix path detection for kernel 4.16
Martin Wilck [Fri, 14 Sep 2018 12:50:59 +0000 (14:50 +0200)]
libmultipath: nvme: fix path detection for kernel 4.16

The path detection logic of the NVMe code relies on the "slaves"
symlinks from NVMe subsys to controllers in sysfs, which have
been removed in the 4.16 kernel.

With this patch, we use the symlinks on the NVMe subsys level
instead.

Example: a multipathed NVMe subsystem with 2 controllers:

/sys/devices/virtual/nvme-subsystem/nvme-subsys2/nvme2n1
/sys/devices/virtual/nvme-fabrics/ctl/nvme2/nvme2c6n1
/sys/devices/virtual/nvme-fabrics/ctl/nvme3/nvme2c8n1

The controllers are found from the subsystem like this:

/sys/devices/virtual/nvme-subsystem/nvme-subsys2/nvme2 ->
    ../../nvme-fabrics/ctl/nvme2
/sys/devices/virtual/nvme-subsystem/nvme-subsys2/nvme3 ->
    ../../nvme-fabrics/ctl/nvme3

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agomultipath-tools: reformat maintainer info
Xose Vazquez Perez [Sun, 1 Jul 2018 15:55:38 +0000 (17:55 +0200)]
multipath-tools: reformat maintainer info

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEV ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
2 years agomultipath-tools: update Hitachi maintainer email
Xose Vazquez Perez [Tue, 26 Jun 2018 13:52:31 +0000 (15:52 +0200)]
multipath-tools: update Hitachi maintainer email

Cc: Matthias Rudolph <Matthias.Rudolph@hitachivantara.com>
Cc: Matthias Rudolph <matthias.rudolph@hds.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEV ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
2 years agokpartx: remove duplicated gpt validation check
Benjamin Marzinski [Wed, 1 Aug 2018 20:57:01 +0000 (15:57 -0500)]
kpartx: remove duplicated gpt validation check

The identical check exists twice in a row.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agokpartx: fix bad dm_devn return
Benjamin Marzinski [Wed, 1 Aug 2018 20:57:00 +0000 (15:57 -0500)]
kpartx: fix bad dm_devn return

dm_devn shouldn't be returning success if you can't create a dm task to
find the device info. Found by coverity.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agokpartx: Fix memory leak of uuid found by coverity
Benjamin Marzinski [Wed, 1 Aug 2018 20:56:59 +0000 (15:56 -0500)]
kpartx: Fix memory leak of uuid found by coverity

After the call to make_prefixed_uuid() allocs uuid, it must be freed if
dm_find_part() fails.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agokpartx: minor fixes to make coverity happy
Benjamin Marzinski [Wed, 1 Aug 2018 20:56:58 +0000 (15:56 -0500)]
kpartx: minor fixes to make coverity happy

an open() failure for fd_dasd will return -1, not 0. Also, cast blocksize
to a uint64_t to keep coverity from complaining about sign extension issues.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agompathpersist: add missing --param-rk usage info
Benjamin Marzinski [Wed, 1 Aug 2018 20:56:57 +0000 (15:56 -0500)]
mpathpersist: add missing --param-rk usage info

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agomultipath tests: add blacklist tests
Benjamin Marzinski [Wed, 1 Aug 2018 20:56:56 +0000 (15:56 -0500)]
multipath tests: add blacklist tests

These are tests to validate the filter_* blacklist functions. They not
only verify that the device is correctly blacklisted/whitelisted, but
they also verify the log messages that are printed out.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agomultipath tests: change to work with old make versions
Benjamin Marzinski [Wed, 1 Aug 2018 20:56:55 +0000 (15:56 -0500)]
multipath tests: change to work with old make versions

the $(file <) operation only works with make 4.2 and above. I tried
running the tests on an old machine and it failed. The $shell function
can do the same thing and multipath has been using that in its
Makefiles for a while.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agolibmultipath: remove _filter_* blacklist functions
Benjamin Marzinski [Wed, 1 Aug 2018 20:56:54 +0000 (15:56 -0500)]
libmultipath: remove _filter_* blacklist functions

The one point of these functions was for _filter_path(), and that wasn't
improved by using them. Since filter_path() only printed one message at
the end, you could have situations where the wwid was blacklisted, but
the blacklist message included the vendor/product instead. Also, the
protocol and property messages were printed twice, and if the device was
on multiple whitelists, only the last one is printed.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agolibmultipath: add "protocol" blacklist option.
Benjamin Marzinski [Wed, 1 Aug 2018 20:56:53 +0000 (15:56 -0500)]
libmultipath: add "protocol" blacklist option.

Multiple users have requested an easy way to setup blacklists that do
things such as blacklisting all non FC and iSCSI devices. Currently
there is no easy way to do this, without knowing in advance what the
devices are.  Looking into the udev property values, I didn't see a
consistent set of values that would worked for all the different types
of requests like this (which would have allowed us to solve this by
extending the "property" blacklist option to allow comparing values,
instead of just keywords).

Instead I've opted to allow multipath to blacklist/whitelist devices
by the protocol strings printed by "multipathd: add new protocol path
wildcard". This check happens after multipath checks the "device"
keyword, and before it checks wwid. This gives users an easily
understandible method to set up these types of blacklists, without
needing to know the exact arrays being used.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agomultipathd: add new protocol path wildcard
Benjamin Marzinski [Wed, 1 Aug 2018 20:56:52 +0000 (15:56 -0500)]
multipathd: add new protocol path wildcard

This patch adds a new path wildcard 'P', that will print the path's
protocol.  For scsi devices, it will additionally print the transport
protocol being used.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agolibmutipath: remove unused IDE bus type
Benjamin Marzinski [Wed, 1 Aug 2018 20:56:51 +0000 (15:56 -0500)]
libmutipath: remove unused IDE bus type

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agompathpersist: add --param-alltgpt option
Benjamin Marzinski [Wed, 1 Aug 2018 20:56:50 +0000 (15:56 -0500)]
mpathpersist: add --param-alltgpt option

From the limited testing I've been able to do, commit 5b54e772
"mpathpersist: add all_tg_pt option", does appear to enable
--param-alltgpt to work correctly on devices that accept the ALL_TG_PT
flag, so I've added the option to mpathpersist.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agomultipath: fix setting conf->version
Benjamin Marzinski [Wed, 1 Aug 2018 20:56:49 +0000 (15:56 -0500)]
multipath: fix setting conf->version

Commit d3b71498 stopped multipath from setting conf->version. Instead,
it was always being set to 0.0.0. Multipathd was still setting this
correctly.

Fixes: d3b71498 "multipath: fix rcu thread cancellation hang"
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agolibmultipath: fix detect alua corner case
Benjamin Marzinski [Wed, 1 Aug 2018 20:56:48 +0000 (15:56 -0500)]
libmultipath: fix detect alua corner case

If retain_attach_hw_handler = no, then the paths tpgs state will never
be checked, and the multipath device will always select the alua
handler, if no other handler is selected. the paths tpgs state
should be checked, regardless of the retain_hwhandler value.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agolibmultipath: remove last of rbd code
Benjamin Marzinski [Wed, 1 Aug 2018 20:56:47 +0000 (15:56 -0500)]
libmultipath: remove last of rbd code

My previous patch to remove the rbd code missed a little bit.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agomultipath-tools: check for C compiler option -Werror=discarded-qualifiers
Mauricio Faria de Oliveira [Mon, 30 Jul 2018 19:37:45 +0000 (16:37 -0300)]
multipath-tools: check for C compiler option -Werror=discarded-qualifiers

The -Werror=discarded-qualifiers option is not supported on GCC 4.8
(ships in Ubuntu 14.04 at least). Use TEST_CC_OPTION to detect that
and fix a build failure.

No regression on Ubuntu 18.04 (GCC 7.3, -Werror=discarded-qualifiers
used).

Fixes: ff307801
"multipath-tools: Makefile.inc: use -Werror=cast-qual"

Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
2 years agomultipath-tools: fix compilation with gcc < 4.9 on dash shell
Mauricio Faria de Oliveira [Mon, 30 Jul 2018 19:37:44 +0000 (16:37 -0300)]
multipath-tools: fix compilation with gcc < 4.9 on dash shell

The dash shell does not interpret '&>' as bash does, so instead
of stdout/stderr redirect, it runs the command in background [1].

    $ for shell in bash dash; do
        echo -n "$shell rc = "
        $shell -c 'echo "int main(void){return 0;}" \
                     | gcc -o /dev/null -c -fFAIL -xc - &>/dev/null; echo $?';
      done
    bash rc = 1
    dash rc = 0
    $ gcc: error: unrecognized command line option ‘-fFAIL’

This misleads the check for C compiler option in Makefile.inc
on Ubuntu 14.04 at least, which uses dash as /bin/sh, and has
GCC 4.8 (no -fstack-protector-strong), then the build fails.

So, replace '&>' with the equivalent '>' and '>&2'.

No regression on Ubuntu 18.04 (GCC 7.3, -fstack-protector-strong used).

Fixes: a8dd838c
"multipath-tools: fix compilation with gcc < 4.9"

[1] https://wiki.ubuntu.com/DashAsBinSh (see '&>' section)

Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
2 years agokpartx: compare image filenames with backing files
Yuval Turgeman [Mon, 16 Jul 2018 12:52:13 +0000 (15:52 +0300)]
kpartx: compare image filenames with backing files

When running `kpartx -d`, find_loop_by_file tries to compare the image's
realpath with the output from loopinfo.lo_name, which may hold only the
basename of the image, making kpartx exit without finding the loopdev
for the image.

In case the original comparison fails, this patch will check the image's
realpath with the loop device's backing_file so that find_loop_by_file
will return the correct value.

Signed-off-by: Yuval Turgeman <yturgema@redhat.com>
2 years agomultipath-tools: fix products names in hwtable
Xose Vazquez Perez [Thu, 5 Jul 2018 18:55:05 +0000 (20:55 +0200)]
multipath-tools: fix products names in hwtable

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEV ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
2 years agolibmultipath: more debug output in alua prioritizer
Martin Wilck [Tue, 3 Jul 2018 07:57:07 +0000 (09:57 +0200)]
libmultipath: more debug output in alua prioritizer

Help debug problems with ALUA commands by emitting more
meaningful error messages.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: alua: retry RTPG for NOT_READY and UNIT_ATTENTION
Martin Wilck [Tue, 3 Jul 2018 07:57:06 +0000 (09:57 +0200)]
libmultipath: alua: retry RTPG for NOT_READY and UNIT_ATTENTION

Use similar logic as the kernel for retrying ALUA commands to
avoid misinterpreting temporary failures as fatal errors.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: alua_rtpg: use condlog for error messages
Martin Wilck [Tue, 3 Jul 2018 07:57:05 +0000 (09:57 +0200)]
libmultipath: alua_rtpg: use condlog for error messages

Map the PRINT_DEBUG macro of the ALUA code to a condlog call, to
be able to better debug SCSI error conditions.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: allow distributions to change partition_delim default
Martin Wilck [Mon, 25 Jun 2018 19:47:23 +0000 (21:47 +0200)]
libmultipath: allow distributions to change partition_delim default

partition_delimiter is UNSET by default, falling back to the kernel
default behavior to use "p" for devices ending in a digit, and ""
for others. However, the udev rules for kpartx have always used the
delimiter "-part". If a map name is changed (e.g. if an alias is
reconfigured), multipathd first sets partition names e.g. to name "mpatha1",
which is later changed to "mpatha-part1" by kpartx during udev rule
processing. That's inefficient and superfluous. However, if a distribution
simply changed DEFAULT_PARTITION_DELIM to "-part", users wouldn't be able
to restore the default behavior any more.

This patch allows to set 'partition_delimiter "/UNSET/"' in multipath.conf
to force the previous default behavior, even if the distribution default is
something other than UNSET. The string "/UNSET/" is not a valid partition
delimiter because filenames can't contain slashes, thus user freedom isn't
constrained by this patch.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: avoid error messages from RDAC check
Martin Wilck [Sun, 24 Jun 2018 19:09:44 +0000 (21:09 +0200)]
libmultipath: avoid error messages from RDAC check

VPD pages are only valid for SCSI devices, so we should disable
the RDAC detection for non-SCSI devices. Otherwise we'll get
an error about VPD inquiry failed.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agomultipathd: fix buffer size in cli_getprkey()
Martin Wilck [Sun, 24 Jun 2018 19:09:43 +0000 (21:09 +0200)]
multipathd: fix buffer size in cli_getprkey()

gcc 8.1 warned about this.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agomultipath-tools: add info about how to enable ALUA in ONTAP
Xose Vazquez Perez [Sat, 30 Jun 2018 23:02:55 +0000 (01:02 +0200)]
multipath-tools: add info about how to enable ALUA in ONTAP

Cc: Martin George <marting@netapp.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEV ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
2 years agomultipath-tools: add directio path_checker for DASD devices
Xose Vazquez Perez [Sat, 30 Jun 2018 22:50:01 +0000 (00:50 +0200)]
multipath-tools: add directio path_checker for DASD devices

tur(default) is only for SCSI devices.

CC: Hannes Reinecke <hare@suse.de>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEV ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
2 years agomultipath-tools: make Product Name mandatory and add all of them
Xose Vazquez Perez [Fri, 29 Jun 2018 21:22:45 +0000 (23:22 +0200)]
multipath-tools: make Product Name mandatory and add all of them

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEV ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
2 years agomultipath: fix return code handling in delegate_to_multipathd
Martin Wilck [Thu, 28 Jun 2018 10:34:46 +0000 (12:34 +0200)]
multipath: fix return code handling in delegate_to_multipathd

Error exit was handled in delegate_to_multipathd() and success
exit after it returned. That's inconsistent. Fix it. Introduce
symbolic return values for better readability.

Fixes: 506d253b "multipath: delegate dangerous commands to multipathd"
Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agomultipath: don't start multipathd unnecessarily
Martin Wilck [Thu, 28 Jun 2018 10:34:45 +0000 (12:34 +0200)]
multipath: don't start multipathd unnecessarily

When multipathd is off, but systemd is monitoring the multipathd socket,
mpath_connect() has the side effect of starting multipathd. That's
superfluous if we aren't going to pass the command at hand to multipathd.
So, only try to open the socket if the command at hand is a candidate
for delegation.

Note: Despite this, some day in the future, we may decide to delegate
almost everything to multipathd.

Fixes: 506d253b "multipath: delegate dangerous commands to multipathd"
Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agomultipathd: fix mpp->hwe handling on path removal
Martin Wilck [Mon, 25 Jun 2018 15:10:20 +0000 (17:10 +0200)]
multipathd: fix mpp->hwe handling on path removal

In my previous patch f0462f0c8338, I overlooked that during path removal,
the path that mpp->hwe references may be removed and and thus mpp->hwe
may become stale. Fix it.

Fixes: f0462f0c8338 "libmultipath: use vector for for pp->hwe and mp->hwe"
Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: print correct default for delay_*_checks
Benjamin Marzinski [Wed, 16 May 2018 22:43:26 +0000 (17:43 -0500)]
libmultipath: print correct default for delay_*_checks

These options default to "no", so they should display that when the
config is printed.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agomultipath-tools: fix help for hds prio
Xose Vazquez Perez [Mon, 21 May 2018 20:03:55 +0000 (22:03 +0200)]
multipath-tools: fix help for hds prio

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEV ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
2 years agomultipath-tools: remove unused SCSI_REV_SIZE
Xose Vazquez Perez [Fri, 15 Jun 2018 14:44:35 +0000 (16:44 +0200)]
multipath-tools: remove unused SCSI_REV_SIZE

It was replaced in 00ee0bda40f8b6ac060211c36a419c699af7f778

Cc: Martin Wilck <mwilck@suse.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEV ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
2 years agoFix lintian complaint about bad whatis entry
Vincent McIntyre [Fri, 15 Jun 2018 14:17:40 +0000 (16:17 +0200)]
Fix lintian complaint about bad whatis entry

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEV ML <dm-devel@redhat.com>
Signed-off-by: Vincent McIntyre <vincent.mcintyre@csiro.au>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
2 years agofixup "libmultipath: merge hwentries inside a conf file"
Martin Wilck [Mon, 18 Jun 2018 09:54:36 +0000 (11:54 +0200)]
fixup "libmultipath: merge hwentries inside a conf file"

The previous patch "libmultipath: merge hwentries inside a conf file"
meant to enable checking for duplicate entries not only between different
"sections" of the configuration (i.e. built-in hwtable, multipath.conf,
config dir files), but also inside every section except the built-in
table. This patch fixes a bug to actually implement this new behavior.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agotests/hwtable: add test for broken hwentry filtering
Martin Wilck [Mon, 18 Jun 2018 09:54:35 +0000 (11:54 +0200)]
tests/hwtable: add test for broken hwentry filtering

Broken hwentries weren't correctly filtered after patch
"libmultipath: merge hwentries inside a conf file". Add a test
case for that.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agomultipath.conf(5): various corrections and clarifications
Martin Wilck [Fri, 8 Jun 2018 10:20:41 +0000 (12:20 +0200)]
multipath.conf(5): various corrections and clarifications

... related to the topics of option precedence, and config file syntax
in general.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: escape '"' chars while dumping config
Martin Wilck [Fri, 8 Jun 2018 10:20:40 +0000 (12:20 +0200)]
libmultipath: escape '"' chars while dumping config

Since 044c5d6b "libmultipath: config parser: Allow '"' in strings",
double quotes can be part of string values in multipath.conf by escaping
them as double-double quotes ('""'). When dumping the configuration,
the un-escaping done during config file parsing must be reverted by replacing
'"' with '""' again.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: implement and use blacklist merging
Martin Wilck [Fri, 8 Jun 2018 10:20:39 +0000 (12:20 +0200)]
libmultipath: implement and use blacklist merging

Implement removal of invalid and duplicate entries in blacklists.

With this fix, we can fully enable the config dump/reload test,
which doesn't fail any more.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: merge "multipath" config sections by wwid
Martin Wilck [Fri, 8 Jun 2018 10:20:38 +0000 (12:20 +0200)]
libmultipath: merge "multipath" config sections by wwid

If more than one "multipath" section exists for a given wwid,
only the properties from the first section are applied, and
those of the later ones are silently discarded.

Fix this by merging mpentries in the same way we do it for hwentries.
Actually, later entries should take precedence, for consistency with
hwentry handling.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agomultipath: implement "multipath -T"
Martin Wilck [Fri, 8 Jun 2018 10:20:37 +0000 (12:20 +0200)]
multipath: implement "multipath -T"

This does the same as "multipathd show config local", and is
provided for convenience.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agomultipathd: implement "show config local"
Martin Wilck [Fri, 8 Jun 2018 10:20:36 +0000 (12:20 +0200)]
multipathd: implement "show config local"

This new command is like "show config", but only those "device" sections are
dumped that match actually present devices in the system. Furthermore, empty
"multipath" sections for all detected multipath maps are dumped. This way,
the output is suitable as a template for creating "multipath.conf".

"multipathd show config local" should produce output that,
when used as configuration file, creates the same configuration
as was in place while it was dumped. Add a test for this to the
test suite.

Some minor differences in the configuration dump can't be avoided
because the ordering of hwtable entries may change (e.g. if a user
adds a device entry for a device which is also in the built-in hwtable,
these entries will be merged end the merged entry will be at the position
of the new entry, i.e. after all built-in hwtable entries), and multipath
sections are added to the configuration. But by all means, path
and mulitpath objects should have the same properties than before.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: allow printing local maps in snprint_config
Martin Wilck [Fri, 8 Jun 2018 10:20:35 +0000 (12:20 +0200)]
libmultipath: allow printing local maps in snprint_config

"mulitpatd show config" only dumps multipath sections for maps which are
present in local configuration files. This patch adds the ability to dump
"multipath" subsections for every locally detected map, even for those
that have no local configuration, and at the same time, skip dumping
multipath configurations for maps that aree not present locally.

This makes it possible for users to generate a multipath.conf template
matching local devices, and e.g. add explicit alias entries for existing
maps. If user_friendly_names is in use, a commented-out config line is added
to the dump output showing the implicitly configured alias, simplifying
identification of the devices.

This facility is optional and will only be used in new commands added
in follow-up patches.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agotests/hwtable: add test for local configuration dump
Martin Wilck [Fri, 8 Jun 2018 10:20:34 +0000 (12:20 +0200)]
tests/hwtable: add test for local configuration dump

This adds another test iteration in test_driver(): It now tests:

 1) with "user-supplied" configuration,
 2) using the full config dump (equivalent with "multipath -t" output),
 3) using the local config dump as implemented in the previous patch.

Again, the properties of paths and maps should be the same for all 3
scenarios. For 3), the "multipath -t" output can't be expected to be
exactly equal to the output in 1), because merging of hwentries may move the
position of a hwentry down in the hwentry list, and empty "multipath"
sections are being added.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: allow dumping only "local" hwtable in snprint_config
Martin Wilck [Fri, 8 Jun 2018 10:20:33 +0000 (12:20 +0200)]
libmultipath: allow dumping only "local" hwtable in snprint_config

This change is key for allowing to dump the "local" multipath configuration
only, i.e. those entries of the hardware table that match existing devices
in the system. By passing the output of the new helper function
get_used_hwes() as the last argument for snprint_config(), only the local
entries will be dumped.

The rationale is that "multipath -t" output is overwhelmingly long for most
use cases; in particular it's not useful as a template for creating a local
configuration.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agotests/hwtable: implement configuration dump + reload test
Martin Wilck [Fri, 8 Jun 2018 10:20:32 +0000 (12:20 +0200)]
tests/hwtable: implement configuration dump + reload test

In order to test dumping and re-reading the configuration, we modify the
test_driver() function so that runs the same test three twice:

 1) with "user-supplied" configuration,
 2) using the config dump from 1) (equivalent with "multipath -t" output) as input
 configuration.

The expectation is that actual paths and maps have same options applied.
Furthermore, the "multipath -T" output from 2) should be the same as from 1),
IOW, "multipath -T" in 2) reproduces its input config file exactly.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agomultipath, multipathd: consolidate config dumping
Martin Wilck [Fri, 8 Jun 2018 10:20:31 +0000 (12:20 +0200)]
multipath, multipathd: consolidate config dumping

"multipath -t" and "multipathd show config" use very similar code.
Consolidate it into a libmultipath function. Simplify it a bit in
the process, and do some "const" and "static" cleanup.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: don't merge by regex in setup_default_blist()
Martin Wilck [Fri, 8 Jun 2018 10:20:30 +0000 (12:20 +0200)]
libmultipath: don't merge by regex in setup_default_blist()

The merging of blacklist entries by regular expression leads
to similar problems as the merging of hwentries. Only merge
blacklist entries if they're exactly equal.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath/hwtable: remove inherited props from ONTAP NVMe
Martin Wilck [Fri, 8 Jun 2018 10:20:29 +0000 (12:20 +0200)]
libmultipath/hwtable: remove inherited props from ONTAP NVMe

With the new hwtable code, properties inherited from generic NVMe
don't need to be duplicated.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: merge hwentries inside a conf file
Martin Wilck [Fri, 8 Jun 2018 10:20:28 +0000 (12:20 +0200)]
libmultipath: merge hwentries inside a conf file

Merging hwentries with identical vendor/product/revision is still useful,
although it's not strictly necessary any more. But such identical entries
should always be merged, not only if they appear in different configuration
files. This requires changing the logic of factorize_hwtable.

By setting -DCHECK_BUILTIN_HWTABLE at compile time, the built-in hwtable
can be checked against duplicates as well.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: don't merge hwentries by regex
Martin Wilck [Fri, 8 Jun 2018 10:20:27 +0000 (12:20 +0200)]
libmultipath: don't merge hwentries by regex

Merging by regular expression is wrong, because regular expressions can't be
matched against each other. Unexpected results for hardware properties may
result. Don't do it any more.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: allow more than one hwentry
Martin Wilck [Fri, 8 Jun 2018 10:20:26 +0000 (12:20 +0200)]
libmultipath: allow more than one hwentry

The previous patch "use vector for for pp->hwe and mp->hwe" changed the
data structure for hwentries. This patch changes actual behavior by
allowing more than one hwentry to match a given path (or multipath).

This fixes several currently broken test cases. The test code is adapted
accordingly.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: use vector for for pp->hwe and mp->hwe
Martin Wilck [Fri, 8 Jun 2018 10:20:25 +0000 (12:20 +0200)]
libmultipath: use vector for for pp->hwe and mp->hwe

Change the data structure of "struct path" and "struct multipath"
such that the "hwe" entry is a vector of hwentry structures rather
than a single hwentry structure. Add respective code to the
constructors and destructors (note that mp->hwe is never allocated,
it's always a pointer to a path hwe).

Change find_hwe() to fill in the passed vector rather than returning
a hwentry pointer. Change the propsel code to look through vectors
of hwentries to determine a given property.

This patch just creates the new data structure and the functions to
deal with them, it doesn't introduce semantic changes.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: add debug messages to hwentry lookup/merging code
Martin Wilck [Fri, 8 Jun 2018 10:20:24 +0000 (12:20 +0200)]
libmultipath: add debug messages to hwentry lookup/merging code

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agotests/hwtable: tests for config file handling and hwentry merging
Martin Wilck [Fri, 8 Jun 2018 10:20:23 +0000 (12:20 +0200)]
tests/hwtable: tests for config file handling and hwentry merging

Add unit tests for parsing "device" and "blacklist" configuration entries and
hwtable entry merging. The tests work by creating a multipath.conf file and one
or more config_dir/*.conf files, reading device entries from both, simulating
discovery of fake paths and multipaths, and verifying these are configured as
expected. The focus is on the behavior if several hwtable or blacklist entries
match a single device.

Most of these tests in this file serve as regression test for follow-up changes.
But Some of the tests are meant to illustrate problems problems with
the current code, which behaves inconsistently in certain cases. By
changing the BROKEN macro at the top of the file, the user can control if broken
behavior causes test failure, or succeeds with a warning. Subsequent patches
will remove the BROKEN tests. Reviewers are encouraged to focus on the BROKEN
tests, which annotate current behavior that follow-up patches are going to change.

Problems with the current code are mainly found in two areas:

 1. It currently makes a difference whether several entries matching the same
 device are in in the same configuration file (default "multipath.conf") or
 distributed over "multipath.conf" and other files under config_dir. This is
 highly unexpected behavior.
 Moreover, in this context, the built-in hwtable can be viewed as yet another
 "configuration file" which is parsed before "multipath.conf". The same problem
 arises: adding a hwentry to "multipath.conf" doesn't necessarily have the same
 effect as adding the same entry to the built-in hwtable and recompiling,
 because different merging logic applies (in short: entries from different
 "configuration files" are merged, but entries from the same "file" aren't).

 This is a major blocker for using the configuration dumped with
 "multipath -t" as input for multipath-tools, because a built-in entry which
 is dumped ends up in "multipath.conf" or a config_dir file, which may change
 the way it's merged with other entries.

  2. The vendor/product/rev IDs are regular expressions, and merging of entries
  by regular expressions simply doesn't work. Entries are merged if a later
  regex, interpreted as a string, matches an earlier added regex. But that's
  incorrect. Except in trivial cases, matching of a regex r2 by another regex
  r1 doesn't say anything about whether strings matched by r2 will be matched
  by r1 as well.

Another, minor issue is the treatment of double quotes.

The way these tests are implemented using the test_driver() function may seem
weird in the first place. The reason is that in a later patch, when we have
configuration-dumping-and-reloading basically working, test_driver() will be
extended to run the same test both with the initial and dumped configuration
and ensure that there are no differences. If I didn't introduce test_driver()
right away, I'd have major, confusing changes in the test code when this
functionality is added.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agotests/test-lib: cmocka helpers to simulate path and map discovery
Martin Wilck [Fri, 8 Jun 2018 10:20:22 +0000 (12:20 +0200)]
tests/test-lib: cmocka helpers to simulate path and map discovery

These functions simulate path discovery and multipath setup with cmocka. They will be
used in the hwtable test case, but may be useful for other future test cases,
too.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agotests/Makefile: autogenerate list of symbols to be wrapped
Martin Wilck [Fri, 8 Jun 2018 10:20:21 +0000 (12:20 +0200)]
tests/Makefile: autogenerate list of symbols to be wrapped

Rather than manually listing all the -Wl,--wrap=... options, autogenerate
a list of functions to be wrapped in a cmocka test. Allowing this not only
for the test file itself but also for additional "test library" source files
requires some Makefile incantations.

Moreover, no need to list globals.c in dependencies, automatic dependency
tracking takes care for this (and avoids recompilation of tests that don't
pull in global.c).

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath/prio: constify simple getters
Martin Wilck [Fri, 8 Jun 2018 10:20:20 +0000 (12:20 +0200)]
libmultipath/prio: constify simple getters

One day we should also constify getprio(), but that requires
touching all prioritizers.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: change prototypes of hwe_regmatch() and find_hwe()
Martin Wilck [Fri, 8 Jun 2018 10:20:19 +0000 (12:20 +0200)]
libmultipath: change prototypes of hwe_regmatch() and find_hwe()

hwentry structures are supposed to be initialized and destroyed
with alloc_hwe() and free_hwe(), respectively. The second
argument is of hwe_regmatch() isn't a real hwentry, just a
vendor/product/revision tuple. Clarify that by adapting the
prototype. This allows to use const arguments in find_hwe(), too.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: some const usage in hwentry handling
Martin Wilck [Fri, 8 Jun 2018 10:20:18 +0000 (12:20 +0200)]
libmultipath: some const usage in hwentry handling

Add some const qualifiers in in the code dealing with hwentries.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath/structs.c: constify some functions
Martin Wilck [Fri, 8 Jun 2018 10:20:17 +0000 (12:20 +0200)]
libmultipath/structs.c: constify some functions

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: remove superfluous conditionals in load_config()
Martin Wilck [Fri, 8 Jun 2018 10:20:16 +0000 (12:20 +0200)]
libmultipath: remove superfluous conditionals in load_config()

In load_config(), conf is freshly allocated, there's no point in checking
previously set values.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: fix memory leak in process_config_dir()
Martin Wilck [Fri, 8 Jun 2018 10:20:15 +0000 (12:20 +0200)]
libmultipath: fix memory leak in process_config_dir()

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agokpartx: no need to use FREE_CONST
Martin Wilck [Fri, 8 Jun 2018 10:20:14 +0000 (12:20 +0200)]
kpartx: no need to use FREE_CONST

A function that returns a result of strdup() doesn't need to declare that
result as const char*.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agomultipath.conf.5: update the description of marginal_path_err_rate_threshold
Wang Ke [Fri, 8 Jun 2018 06:47:46 +0000 (14:47 +0800)]
multipath.conf.5: update the description of marginal_path_err_rate_threshold

    The path will not reinstate for \fImarginal_path_err_rate_threshold\fR
    seconds unless there is one active path, when it should be marginal_path_err_recheck_gap_time seconds
    instead of marginal_path_err_rate_threshold.

Signed-off-by: Ke Wang <wangke16@huawei.com>
2 years agomultipath: don't check timestamps without a path
Benjamin Marzinski [Tue, 5 Jun 2018 22:40:21 +0000 (17:40 -0500)]
multipath: don't check timestamps without a path

If a path was blacklisted, pathvec could exist but have no path in it.
print_cmd_valid wasn't checking this before calling
find_multipaths_check_timeout(). This was causing it to dereference a
NULL pointer in these cases.

Cc: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agompathpersist: fix aptpl support
Benjamin Marzinski [Tue, 5 Jun 2018 22:40:20 +0000 (17:40 -0500)]
mpathpersist: fix aptpl support

The "Active Persist Through Power Loss" flag must be set whenever a key
is registered. However, there is no way for multipathd to know if this
was set by mpathpersist. The result is that if a path goes down and
comes back up (or if it wasn't up when mpathpersist was first run)
multipathd will clear the aptpl flag when it reregisters the key on it.

To fix this, multipath.conf now accepts an optional ":aptpl" appended
on the reservation_key value. If this is added to the reservation_key
multipathd will set the aptpl flag when it reregisters the key. If
reservation_key is set to "file", this will automatically be tracked
in the /etc/multipath/prkeys file.

To track this flag in the prkeys file, without changing the format
I've made "0x<key>" stand for non-aptpl keys, and "0X<key>" stand
for aptpl keys. Since previously, all keys used a lower-case x, this
will default to the current behavior for existing keys. Obviously, the
next time mpathpersist is run, this will be changed if --param-aptpl
is used.  Since there are no more flags that are in sg_persist that
multipathd needs to care about in mpathpersist, there shouldn't need
to be any more flags added to the prkeys file.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agompathpersist: add all_tg_pt option
Benjamin Marzinski [Fri, 1 Jun 2018 22:22:01 +0000 (17:22 -0500)]
mpathpersist: add all_tg_pt option

Some arrays, such as the EMC VNX, don't follow the scsi persistent
reservations spec in making key registrations per I_T NEXUS. Instead,
the registration is shared by all target ports connected to a given
host.  This causes mpathpersist to fail whenever it tries to register a
key, since it will receive a registration conflict on some of the paths.

To deal with this, mpathpersist needs to track the hosts that it has
done a registration on, and only register once per host. The new
"all_tg_pt" multipath.conf option is used to set which arrays need this
feature.  I currently don't know if all EMC VNX arrays handle persistent
reservations like this, or if it is configurable. A future patch will
update the VNX built-in config, if this is indeed their default (or
only) setting.

Multipathd doesn't need to worry about this. It is often the case that
when a path device comes back, it will still have the keys registered to
it. Because of this, multipathd uses register-and-ignore, which means
that it won't cause an error if the registration has already happened
down a different target port.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agolibmultipath: remove rbd code
Benjamin Marzinski [Fri, 1 Jun 2018 22:22:02 +0000 (17:22 -0500)]
libmultipath: remove rbd code

The Ceph tean has asked to drop support for multipathed rbd, since it
was running into data corruption issues. There was never an upstream
Ceph release based on it, and because of the corruption, there should be
no users of this code. This patch simply reverts all the rbd code from
multipath.

Cc: Michael Christie <mchristi@redhat.com>
Cc: Jason Dillaman <dillaman@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 years agolibmultipath: fix error parsing "find_multipaths strict"
Martin Wilck [Tue, 15 May 2018 12:32:44 +0000 (14:32 +0200)]
libmultipath: fix error parsing "find_multipaths strict"

If "find_multipaths strict" is set in multipath.conf, the error message
"illegal value for find_multipaths: strict" is printed. This causes no
functional problem, as "strict" happens to be the default, fallback
value. It should be fixed nonetheless. FIND_MULTIPATHS_STRICT, having
the highest numeric value, must be last in the enum.

Fixes: c36f2f42 "libmultipath: change find_multipaths option to multi-value"
Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agomultipathd: handle errors in uxlsnr as fatal
Martin Wilck [Wed, 21 Mar 2018 09:34:19 +0000 (10:34 +0100)]
multipathd: handle errors in uxlsnr as fatal

The ppoll() calls of the uxlsnr thread are vital for proper functioning of
multipathd. If the uxlsnr thread can't open the socket or fails to call ppoll()
for other reasons, quit the daemon. If we don't do that, multipathd may
hang in a state where it can't be terminated any more, because the uxlsnr
thread is responsible for handling all signals. This happens e.g. if
systemd's multipathd.socket is running in and multipathd is started from
outside systemd.

24f2844 "multipathd: fix signal blocking logic" has made this problem more
severe. Before that patch, the signals weren't actually blocked in any thread.
That's not to say 24f2844 was wrong. I still think it's correct, we just
need this one on top.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agolibmultipath: don't reject maps with undefined prio
Martin Wilck [Wed, 21 Mar 2018 09:34:18 +0000 (10:34 +0100)]
libmultipath: don't reject maps with undefined prio

libmultipath's prio routines can deal with pp->priority == PRIO_UNDEF
just fine. PRIO_UNDEF is just a very low priority. So there's
no reason to reject setting up a multipath map because paths have
undefined priority.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2 years agomultipath-tools: configure hitachi ams2000 and hus100 as full active arrays
Xose Vazquez Perez [Mon, 14 May 2018 15:30:17 +0000 (17:30 +0200)]
multipath-tools: configure hitachi ams2000 and hus100 as full active arrays

AMS2000 and HUS100 families are active/active arrays.

Based on https://support.hitachivantara.com/download/epcra/df818913.pdf
and internal hitachi docs.

Cc: Matthias Rudolph <Matthias.Rudolph@hitachivantara.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEV ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
2 years agomultipath-tools: refresh kernel-doc from kernel sources
Xose Vazquez Perez [Sat, 12 May 2018 22:39:42 +0000 (00:39 +0200)]
multipath-tools: refresh kernel-doc from kernel sources

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 years agomultipath-tools: add +x to doc-preclean.pl and split-man.pl
Xose Vazquez Perez [Sat, 12 May 2018 22:39:41 +0000 (00:39 +0200)]
multipath-tools: add +x to doc-preclean.pl and split-man.pl

It is not strictly necessary, but it helps identify bin files.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
2 years agomultipath-tools: fix compilation with musl libc
Xose Vazquez Perez [Fri, 11 May 2018 16:39:44 +0000 (18:39 +0200)]
multipath-tools: fix compilation with musl libc

In file included from alias.c:15:
file.h:9:47: error: unknown type name ‘mode_t’; did you mean ‘time_t’?
 int ensure_directories_exist(const char *str, mode_t dir_mode);
                                               ^~~~~~
                                               time_t

sysfs.c: In function ‘sysfs_is_multipathed’:
sysfs.c:304:15: error: ‘PATH_MAX’ undeclared (first use in this function); did you mean ‘PATH_UP’?
  char pathbuf[PATH_MAX];
               ^~~~~~~~
               PATH_UP

Cc: Martin Wilck <mwilck@suse.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
2 years agomultipath-tools: Remove trailing/leading whitespaces and reformat code
Xose Vazquez Perez [Fri, 11 May 2018 13:43:11 +0000 (15:43 +0200)]
multipath-tools: Remove trailing/leading whitespaces and reformat code

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>