multipath-tools/.git
10 months agokpartx(coverity): fix resource leak warning
Martin Wilck [Tue, 8 Jan 2019 22:53:58 +0000 (23:53 +0100)]
kpartx(coverity): fix resource leak warning

This was an easy-to-fix false positive.

Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agomultipathd: avoid crash in cli_list_path
Martin Wilck [Tue, 8 Jan 2019 23:25:43 +0000 (00:25 +0100)]
multipathd: avoid crash in cli_list_path

multipathd can be crashed by passing an invalid path name
to the "show path" command. Fix it.

10 months agomultipath_tools: remove ENABLE_RADOS
Martin Wilck [Tue, 8 Jan 2019 11:32:46 +0000 (12:32 +0100)]
multipath_tools: remove ENABLE_RADOS

This is pointless since we removed RBD support altogether.

Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agomultipath: fix gcc 4.8 uninitialized variable warning
Martin Wilck [Tue, 8 Jan 2019 11:32:45 +0000 (12:32 +0100)]
multipath: fix gcc 4.8 uninitialized variable warning

gcc 4.8 complained about "err" not being initialized. Fix, and
simplify.

Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath: fix compilation with older kernel headers
Martin Wilck [Tue, 8 Jan 2019 11:32:44 +0000 (12:32 +0100)]
libmultipath: fix compilation with older kernel headers

Compilation fails if the kernel headers don't provide
"linux/nvme_ioctl.h". Fix that by shipping the kernel header
file from nvme-cli.

Fixes: 17c71c79e276 "libmultipath: add wrapper library for nvme ioctls"
Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath: dm_is_mpath cleanup
Benjamin Marzinski [Tue, 11 Dec 2018 21:23:04 +0000 (15:23 -0600)]
libmultipath: dm_is_mpath cleanup

Add condlog() message in dm_is_mpath() fails and change the
dm_is_mpath() call in watch_dmevents() to check the return value with
the same syntax as all the other callers.

Fixes: 9050cd5a "libmultipath: fix false removes in dmevents polling code"
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
10 months agolibmultipath/foreign/nvme: fix ouput for "%n" wildcard
Martin Wilck [Sun, 23 Dec 2018 22:21:26 +0000 (23:21 +0100)]
libmultipath/foreign/nvme: fix ouput for "%n" wildcard

The output for "%n" ("name") is broken: it omits the NSID,
and thus it isn't unique per namespace; and it duplicates the
NQN. Change the format to "$NQN:nsid.$NSID".

Real-world example:
nqn.1992-08.com.netapp:sn.7c6b997ca1f611e8abb200a09890f5bf:subsystem.netapp-nvme-svm-subsystem:nsid.1

Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath/foreign/nvme: indicate ANA support
Martin Wilck [Sun, 23 Dec 2018 22:21:25 +0000 (23:21 +0100)]
libmultipath/foreign/nvme: indicate ANA support

Indicate ANA support in the "hwhandler" output field.

Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath/foreign/nvme: show ANA state
Martin Wilck [Sun, 23 Dec 2018 22:21:24 +0000 (23:21 +0100)]
libmultipath/foreign/nvme: show ANA state

Obtain the ana_state attribute from the kernel and
use it to display information about path state and
"priority" of native NVMe multipath.

Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath/foreign/nvme: use failover topology
Martin Wilck [Sun, 23 Dec 2018 22:21:23 +0000 (23:21 +0100)]
libmultipath/foreign/nvme: use failover topology

The native multipath driver does not use a multibus policy
as the current topology output of the NVMe foreign code
indicates. Rather, it uses failover policy, queueing all
IO to the current path until a failure occurs.

Change the data structures of the nvme foreign library
accordingly.

Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath: detect_prio: try ANA for NVMe
Martin Wilck [Sun, 23 Dec 2018 22:21:22 +0000 (23:21 +0100)]
libmultipath: detect_prio: try ANA for NVMe

Check NVMe devices support ANA, and if yes, use ANA
for priority checks. The patch moves the ANA detection
functionality from the ANA prioritizer into generic code,
and uses it.

Cc: lijie <lijie34@huawei.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath: ANA prioritzer: use nvme wrapper library
Martin Wilck [Sun, 23 Dec 2018 22:21:21 +0000 (23:21 +0100)]
libmultipath: ANA prioritzer: use nvme wrapper library

Use the previously introduced NVME wrapper library for
the passthrough commands from the ANA prioritizer. Discard
code duplicated from nvme-cli from the ana code itself.

Furthermore, make additional cleanups in the ANA prioritizer:

 - don't use the same enum for priorities and error codes
 - use char* arrays for error messages and state names
 - return -1 prio to libmultipath for all error cases
 - check for overflow in check_ana_state()
 - get_ana_info(): improve readability with is_anagrpid_const
 - priorities: PERSISTENT_LOSS state is worse than INACCESSIBLE
 and CHANGE

Cc: lijie <lijie34@huawei.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agomultipath-tools: add ANA support for NVMe device
lijie [Sun, 23 Dec 2018 22:21:20 +0000 (23:21 +0100)]
multipath-tools: add ANA support for NVMe device

Add support for Asynchronous Namespace Access as specified in NVMe 1.3
TP 4004. The states are updated through reading the ANA log page.

By default, the native nvme multipath takes over the nvme device.
We can pass a false to the parameter 'multipath' of the nvme-core.ko
module,when we want to use multipath-tools.

Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath: add wrapper library for nvme ioctls
Martin Wilck [Sun, 23 Dec 2018 22:21:19 +0000 (23:21 +0100)]
libmultipath: add wrapper library for nvme ioctls

Create a small wrapper around the code from nvme-cli provide
the necessary functionality (and only that) for libmultipath.

libmultipath code should include "nvme-lib.h" and possibly
"nvme.h" (the latter with -Invme"). The nvme-cli code is
rewritten, changing all functions to static linkage, and
included by nvme-lib.c, so that only those functions that
are actually exported via nvme-lib.c become part of
libmultipath.

This allows us to include the nvme-cli code without modifications,
and at the same time not carry around binary code for stuff we
don't need.

When additional functionality from nvme-cli is needed, more
wrappers need to be added to nvme-lib.[hc].

Cc: lijie <lijie34@huawei.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath: add files from nvme-cli for NVMe support
Martin Wilck [Sun, 23 Dec 2018 22:21:18 +0000 (23:21 +0100)]
libmultipath: add files from nvme-cli for NVMe support

Added code from https://github.com/linux-nvme/nvme-cli in the
"libmultipath/nvme" subdirectory.

This code is licensed under GPL v2.0.

The idea is to add this code unmodified and add a simple wrapper
for libmultipath, so that upstream nvme-cli bug fixes can be
most easily integrated.

Cc: lijie <lijie34@huawei.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agomultipathd: don't check foreign paths every tick
Martin Wilck [Sun, 23 Dec 2018 22:21:17 +0000 (23:21 +0100)]
multipathd: don't check foreign paths every tick

We don't do this for native paths, so don't do it for
foreigns, either. Instead use max_checkint for foreign
paths, always.

Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath: restore PG prio in update_multipath_strings
Martin Wilck [Sun, 23 Dec 2018 22:21:16 +0000 (23:21 +0100)]
libmultipath: restore PG prio in update_multipath_strings

update_multipath_strings() destroys and recreates the
pathgroup vector. This wipes information previously
stored. Restore the path group priorities.

Fixes: efc7407bed65 "libmultipath: don't update path groups when
 printing"
Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath: make close_fd() a common helper
Martin Wilck [Sun, 23 Dec 2018 22:21:15 +0000 (23:21 +0100)]
libmultipath: make close_fd() a common helper

move close_fd() into util.c.

Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath: add ARRAY_SIZE helper
Martin Wilck [Sun, 23 Dec 2018 22:21:14 +0000 (23:21 +0100)]
libmultipath: add ARRAY_SIZE helper

Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agosetup_map: wait for pending path checkers to finish
Martin Wilck [Sun, 23 Dec 2018 22:21:13 +0000 (23:21 +0100)]
setup_map: wait for pending path checkers to finish

The timeout for synchronous checks is only 1ms when async path
checking is used, which may easily be missed on busy systems.
That's not a problem for the path checker, because it simply
repeats the check one tick later. However, when maps are
set up (e.g. when new paths are detected), it's desirable
to get the number of active paths right. Therefore, wait a bit
longer if path checkers are found pending in setup_map().

Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agomultipath.conf.5: man page fixes for san_path_err_xy
Martin Wilck [Sun, 23 Dec 2018 22:21:12 +0000 (23:21 +0100)]
multipath.conf.5: man page fixes for san_path_err_xy

This adds a paragraph about the san_path_err algorithm to the
"shaky paths" section of the man page.

Cc: Guan Junxiong <guanjunxiong@huawei.com>
Cc: M Muneendra Kumar <mmandala@brocade.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agomultipathd: marginal_path overrides san_path_err
Martin Wilck [Sun, 23 Dec 2018 22:21:11 +0000 (23:21 +0100)]
multipathd: marginal_path overrides san_path_err

disable san_path_err_XY if marginal path checking is
enabled. Also warn about san_path_err_XY being deprecated,
and warn if any of the two is used in combination with
delay_XY_checks.

Add some minor fixes to the san_path_err code, and a comment
that explains a part of the code that was not immediately obvious
to me.

Cc: Guan Junxiong <guanjunxiong@huawei.com>
Cc: M Muneendra Kumar <mmandala@brocade.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agoRevert "multipath-tools: discard san_path_err_XXX feature"
Martin Wilck [Sun, 23 Dec 2018 22:21:10 +0000 (23:21 +0100)]
Revert "multipath-tools: discard san_path_err_XXX feature"

This reverts commit 9cf6a48f18a291982af34b4fb0110654b94e591c.
We removed this functionality prematurely. I am not convinced
that the "marginal_path" code really replaces it. Let customers
evaluate the different options, and vote with their feet.

Cc: Guan Junxiong <guanjunxiong@huawei.com>
Cc: M Muneendra Kumar <mmandala@brocade.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath: propsel: don't print undefined values
Martin Wilck [Sun, 23 Dec 2018 22:21:09 +0000 (23:21 +0100)]
libmultipath: propsel: don't print undefined values

print_off_int_undef() may return 0 if passed NU_UNDEF,
in which case the buffer contents are undefined.

Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agomultipath.conf.5: explain "shaky" path detection
Martin Wilck [Sun, 23 Dec 2018 22:21:08 +0000 (23:21 +0100)]
multipath.conf.5: explain "shaky" path detection

Explain the "shaky path" detection algorithms, and how they
relate to each other.

Cc: Guan Junxiong <guanjunxiong@huawei.com>
Cc: M Muneendra Kumar <mmandala@brocade.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
10 months agolibmultipath: Increase SERIAL_SIZE to 128 bytes
Kyle Mahlkuch [Sun, 23 Dec 2018 22:21:07 +0000 (23:21 +0100)]
libmultipath: Increase SERIAL_SIZE to 128 bytes

Certain IBM FlashSystem LUNs can return up to 85 bytes of serial
number in the Unit Serial Number VPD page, which is larger than
the current SERIAL_SIZE definition of 65 bytes. Since the max
size of this field does not appear to be defined in SPC, increasing
to 128 bytes should hopefully prevent us from hitting this
in future.

This is an example of a serial number from a FlashSystem:
Unit serial number VPD page:
Unit serial number: 3321360050764008101AB300000000000012204214503IBMfcp

Before this patch multipath returns the error:
Jul 17 11:24:58 | vpd pg80 overflow, 85/65 bytes required

After the patch is applied the error no longer occur.

Signed-off-by: Kyle Mahlkuch<kmahlkuc@linux.vnet.ibm.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agomultipath: use symbolic return value and exit code
Martin Wilck [Mon, 10 Dec 2018 09:49:59 +0000 (10:49 +0100)]
multipath: use symbolic return value and exit code

Use an enum to represent the return code and exit status of
multipath and its most important subroutine, configure().
This clarifies the confusing use of booleans and status
codes a bit, hopefully.

This patch doesn't introduce a change in behavior.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agomultipathd: simplify retry logic in ev_add_path()
Martin Wilck [Mon, 10 Dec 2018 09:49:58 +0000 (10:49 +0100)]
multipathd: simplify retry logic in ev_add_path()

Move the retry loop for DOMAP_RETRY out of the redundant outer
if conditional, and replace the goto construct with a while loop.

Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agodomap(): use symbolic return value
Martin Wilck [Mon, 10 Dec 2018 10:06:33 +0000 (11:06 +0100)]
domap(): use symbolic return value

Use an enum for the already-symbolic return value of domap(), and
avoid the use of "<= 0" for the return value, which is against the
spirit of symbolic values. A return value less or equal than 0 means
DOMAP_FAIL or DOMAP_RETRY. Use the fact that DOMAP_RETRY is only
returned in the ACT_CREATE case for simplification of the logic
in those cases where ACT_CREATE is not used.

Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agocoalesce_paths(): use symbolic return value
Martin Wilck [Mon, 10 Dec 2018 09:49:56 +0000 (10:49 +0100)]
coalesce_paths(): use symbolic return value

Use an enum to represent the return value of coalesce_paths() to
improve readability of the code.
This patch doesn't introduce changes in behavior.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: avoid syslog loglevel > LOG_DEBUG
Martin Wilck [Mon, 10 Dec 2018 09:49:55 +0000 (10:49 +0100)]
libmultipath: avoid syslog loglevel > LOG_DEBUG

We use condlog(5, ...) in some places, which doesn't work well
with syslog.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: improve logging from orphan_paths
Martin Wilck [Mon, 10 Dec 2018 09:49:54 +0000 (10:49 +0100)]
libmultipath: improve logging from orphan_paths

It's a big difference if a map is flushed from DM (changing kernel
state) or just removed from internal multipathd tables. Convey
this information in log messages.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agomultipathd: uev_remove_path: remove redundant orphan_paths call
Martin Wilck [Mon, 10 Dec 2018 09:49:53 +0000 (10:49 +0100)]
multipathd: uev_remove_path: remove redundant orphan_paths call

The remove_map_and_stop_waiter() call which follows immediately
will do the same thing.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agotests: add unit tests for bitmask functions
Martin Wilck [Mon, 10 Dec 2018 09:49:52 +0000 (10:49 +0100)]
tests: add unit tests for bitmask functions

Add unit tests for the bitmask management functions the previous
patch added in util.h.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: coalesce_paths: fix size mismatch handling
Martin Wilck [Mon, 10 Dec 2018 09:49:51 +0000 (10:49 +0100)]
libmultipath: coalesce_paths: fix size mismatch handling

When there are paths with the same WWID but different sizes, and
coalesce_paths() walks the pathvec, it checks paths _after_
the current one for size mismatch and sets ACT_REJECT. However,
these paths will be reached in the main loop later, and this time
the already handled paths will not be checked for size mismatch;
thus a map could be created, possibly even with mismatching
devices.

Fix that by tracking which paths were already discarded, and
skipping them in the main loop later.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: adopt_paths: check for size match
Martin Wilck [Mon, 10 Dec 2018 09:49:50 +0000 (10:49 +0100)]
libmultipath: adopt_paths: check for size match

In coalesce_paths() and ev_add_path(), we check for size mismatch.
We should do it here, too.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: decrease log level for failed VPD c9
Martin Wilck [Mon, 10 Dec 2018 09:49:49 +0000 (10:49 +0100)]
libmultipath: decrease log level for failed VPD c9

It's normal that SCSI devices don't support this page. Only RDAC
devices need it.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: simplify devt2devname()
Martin Wilck [Mon, 10 Dec 2018 09:49:48 +0000 (10:49 +0100)]
libmultipath: simplify devt2devname()

Since 1e79548, we don't fallback from /sys/dev/block to
/proc/partitions anyway. The strncmp() at "skip_proc"
is doomed to fail. So we might as well return immediately.

Also, decrease the log level; whether this failure is
noteworthy is rather up to the callers to decide.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmpathpersist/update_map_pr: decrease log level for nop
Martin Wilck [Mon, 10 Dec 2018 09:49:47 +0000 (10:49 +0100)]
libmpathpersist/update_map_pr: decrease log level for nop

No need to log at -v3 if nothing to do.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: decrease log level of "prioritizer refcount" message
Martin Wilck [Mon, 10 Dec 2018 09:49:46 +0000 (10:49 +0100)]
libmultipath: decrease log level of "prioritizer refcount" message

This was important during development of the refcounting code, but
now it isn't any more.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agomultipathd: decrease log level of checker timing
Martin Wilck [Mon, 10 Dec 2018 09:49:45 +0000 (10:49 +0100)]
multipathd: decrease log level of checker timing

These messages, printed for every checker invocation, were helpful
in the past but they don't make much sense under normal operations.
The same information can be derived from journal time stamps on
recent Linux distributions.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: increase log level of map removal
Martin Wilck [Mon, 10 Dec 2018 09:49:44 +0000 (10:49 +0100)]
libmultipath: increase log level of map removal

This is an important event which we want to see with -v3.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: decrease log level of word splitting
Martin Wilck [Mon, 10 Dec 2018 09:49:43 +0000 (10:49 +0100)]
libmultipath: decrease log level of word splitting

This will make log level 4 actually usable.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: decrease log level of "disassembled" messages
Martin Wilck [Mon, 10 Dec 2018 09:49:42 +0000 (10:49 +0100)]
libmultipath: decrease log level of "disassembled" messages

These messages are printed from update_multipath_strings, and
thus from check_path(), which is too much for -v3.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: avoid frequent messages from filter_property()
Martin Wilck [Mon, 10 Dec 2018 09:49:41 +0000 (10:49 +0100)]
libmultipath: avoid frequent messages from filter_property()

Unlike the other filter functions, filter_property() is called
on every pathinfo() call, and prints a message with -v3 every
time. Avoid that by using a lower log priority for the call
from pathinfo().

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: decrease verbosity of TUR checker messages
Martin Wilck [Mon, 10 Dec 2018 09:49:40 +0000 (10:49 +0100)]
libmultipath: decrease verbosity of TUR checker messages

The thread startup/stop messages aren't very interesting.
Decrease their verbosity level to v4.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: decrease verbosity of pathinfo messages
Martin Wilck [Mon, 10 Dec 2018 09:49:39 +0000 (10:49 +0100)]
libmultipath: decrease verbosity of pathinfo messages

Reduce the verbosity of pointless messages from pathinfo(), in
particular those that are printed on every checker invocation.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agomultipath-tools: decrease verbosity of state messages
Martin Wilck [Mon, 10 Dec 2018 09:49:38 +0000 (10:49 +0100)]
multipath-tools: decrease verbosity of state messages

With verbosity level 3, thousands of "path state = running" messages
are logged, which are pretty much irrelevant, as the checker state
takes precedence. Also the "get_state" message is totally useless.

With this patch, the path state is reported exactly once per path
and check.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agotests/hwtable: adjust to new checker API
Martin Wilck [Mon, 10 Dec 2018 09:49:37 +0000 (10:49 +0100)]
tests/hwtable: adjust to new checker API

checker.name doesn't exist any more.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agotests/hwtable: set multipath_dir in local configuration
Martin Wilck [Mon, 10 Dec 2018 09:49:36 +0000 (10:49 +0100)]
tests/hwtable: set multipath_dir in local configuration

If internal libmultipath APIs change (such as, recently, the
checker API), test programs will fail because they'll link
with the standard system prioritizer / checker / foreign APIs.

Make sure we always link with our own shared libraries.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agolibmultipath: fix false removes in dmevents polling code
Benjamin Marzinski [Wed, 28 Nov 2018 06:13:24 +0000 (00:13 -0600)]
libmultipath: fix false removes in dmevents polling code

dm_is_mpath() would return 0 if either a device was not a multipath
device or if the libdevmapper command failed. Because dm_is_mpath()
didn't distinguish between these situations, dm_get_events() could
assume that a device was not really a multipath device, when in fact it
was, and the libdevmapper command simply failed. This would cause the
dmevents polling waiter to stop monitoring the device.

In reality, the call to dm_is_mpath() isn't necessary, because
dm_get_events() will already verify that the device name is on the list
of devices to wait for. However, if there are a large number of
non-multipath devices on the system, ignoring them can be useful.  Thus,
if dm_is_mpath() successfully runs the libdevmapper command and verifies
that the device is not a multipath device, dm_get_events() should skip
it. But if the libdevmapper command fails, dm_get_events() should still
check the device list, to see if the device should be monitored.

This commit makes dm_is_mpath() return -1 for situations where
the libdevmapper command failed, and makes dm_get_events() only ignore
the device on a return of 0.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
11 months agolibmultipath: cleanup pthread_cleanup_pop call
Benjamin Marzinski [Wed, 28 Nov 2018 06:13:23 +0000 (00:13 -0600)]
libmultipath: cleanup pthread_cleanup_pop call

pthread_cleanup_push() and pthread_cleanup_pop() must be called in the
same lexical scope.  In uevent_listen(), the pthread_cleanup_pop() call
to cleanup the udev monitor is called in a nested 'if' block, within
the block where pthread_cleanup_push() is called.  Since this is a
single-statement if block, it doesn't actually cause any problems, but
it should be fixed anyways.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
11 months agolibmpathpersist: fix off-by-one error in PRIN length check
Martin Wilck [Mon, 26 Nov 2018 16:29:33 +0000 (17:29 +0100)]
libmpathpersist: fix off-by-one error in PRIN length check

The length check added by bf25392f4e98 was off by one, so
that a warning was printed even for correct responses
for PERSISTENT_RESERVE_IN READ_FULL_STATUS service actions.
Non-fatal, but should be fixed nonetheless.

Fixes: bf25392f4e98 "libmpathpersist: fix stack overflow in
   mpath_format_readfullstatus()"
Signed-off-by: Martin Wilck <mwilck@suse.com>
11 months agomultipathd: fix mpp->hwe handling when paths are freed
Benjamin Marzinski [Wed, 21 Nov 2018 04:24:44 +0000 (22:24 -0600)]
multipathd: fix mpp->hwe handling when paths are freed

Commit 1f962693 didn't deal with all of cases where a path that was part
of a multipath device could be removed. verify_paths() removes any path
that no longer exists in sysfs.  mpp->hwe needs to be updated here as
well, since verify_paths() could remove the path whose hwe vector is
pointed to by mpp->hwe.  Also, now that extract_hwe_from_path() is
called in verify_paths(), the extract_hwe_from_path() calls that
happened immediately after verify_paths() can be dropped.

The other part of this fix is mostly cosmetic. In ev_add_path(), if
domap() fails after the path is added to the multipath device and
verify_paths() is called, the code can loop back to the rescan label. If
the size of the path or the multipath device changed in the interim,
ev_add_path() would remove the path, without updating mpp->hwe; but
there is no way for the size to change. Just to make that clearer in the
code, I've moved the size check to before the rescan label so it only
happens once.

Fixes: 1f962693 "multipathd: fix mpp->hwe handling on path removal"
Cc: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
12 months agoBump version to 0.7.9 0.7.9
Christophe Varoqui [Wed, 14 Nov 2018 07:37:05 +0000 (08:37 +0100)]
Bump version to 0.7.9

12 months agomultipathd: reset delay_wait_checks counter on failure
Martin Wilck [Tue, 13 Nov 2018 21:30:52 +0000 (22:30 +0100)]
multipathd: reset delay_wait_checks counter on failure

If path reinstantiation is delayed by delay_wait_checks, wait_checks
is counting down, the path fails during the delay phase, and then
comes up again, the wait_check counter starts counting down at the
same value where it previously stopped, which may be very low (even 1).

To avoid that, reset the counter to pp->delay_wait_checks if a failure
is encountered during the delay phase.

Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agomultipathd: fix irritating "minor number mismatch" message
Martin Wilck [Tue, 13 Nov 2018 21:30:51 +0000 (22:30 +0100)]
multipathd: fix irritating "minor number mismatch" message

This is really an alias mismatch, not a minor number mismatch.

Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agomultipathd: only grab conf once for filter_path()
Martin Wilck [Fri, 2 Nov 2018 12:24:02 +0000 (13:24 +0100)]
multipathd: only grab conf once for filter_path()

This saves a possibly large number of cleanup push/pop calls and
slightly improves readability.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agomultipathd: make DAEMON_SHUTDOWN a terminal state
Martin Wilck [Fri, 2 Nov 2018 12:24:01 +0000 (13:24 +0100)]
multipathd: make DAEMON_SHUTDOWN a terminal state

It can happen that, before the main thread reacts on DAEMON_SHUTDOWN
and starts cancelling threads, another thread resets the state to
something else. Fix that.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agomultipathd: set DAEMON_CONFIGURE from uxlsnr thread
Martin Wilck [Fri, 2 Nov 2018 12:24:00 +0000 (13:24 +0100)]
multipathd: set DAEMON_CONFIGURE from uxlsnr thread

Commit ee01e841 had the intention to make multipathd quit if
the client socket couldn't be set up, because the unix socket
listener is vital for signal handling in multipathd.
But during startup, this condition might be lost if the main
thread doesn't wait for the unix listener to initialize.

Fixes: ee01e841 "multipathd: handle errors in uxlsnr as fatal"

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agomultipathd: open client socket early
Martin Wilck [Fri, 2 Nov 2018 12:23:59 +0000 (13:23 +0100)]
multipathd: open client socket early

Open the unix socket in multipathd code and pass the fd to
uxsock_listen(). This will enable us to make the main thread
wait for successful socket initialization in a follow-up patch.

Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agomultipathd: print error message if checkint is not initialized
Martin Wilck [Fri, 2 Nov 2018 12:23:58 +0000 (13:23 +0100)]
multipathd: print error message if checkint is not initialized

This is just a safety measure in case I overlooked something wrt
the checkint initialization. It could be reverted once we know the
error message isn't triggered.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agomultipathd: remove init_path_check_interval()
Martin Wilck [Fri, 2 Nov 2018 12:23:57 +0000 (13:23 +0100)]
multipathd: remove init_path_check_interval()

After "libmultipath: set pp->checkint in store_pathinfo()",
pp-checkint should always be properly initialized, so this code
is not needed any more.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath: set pp->checkint in store_pathinfo()
Martin Wilck [Fri, 2 Nov 2018 12:23:56 +0000 (13:23 +0100)]
libmultipath: set pp->checkint in store_pathinfo()

store_pathinfo is called with valid conf pointer anyway, so
checkint is available. pp->checkint is now valid for every
path after path_discovery().

This fixes a bad conf access in cli_add_path().

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath/checkers: cleanup class/instance model
Martin Wilck [Fri, 2 Nov 2018 12:21:25 +0000 (13:21 +0100)]
libmultipath/checkers: cleanup class/instance model

The checkers code implicitly uses a sort-of OOP class/instance model,
but very clumsily. Separate the checker "class" and "instance" cleanly,
and do a few further cleanups (constifications etc) on the way.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath: sync_map_state: log failing paths
Martin Wilck [Fri, 2 Nov 2018 12:21:24 +0000 (13:21 +0100)]
libmultipath: sync_map_state: log failing paths

Emit a log message when force-failing exisiting paths.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath: coalesce_paths: improve logging of orphaned paths
Martin Wilck [Fri, 2 Nov 2018 12:21:23 +0000 (13:21 +0100)]
libmultipath: coalesce_paths: improve logging of orphaned paths

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agomultipathd: check_path: improve logging for "unusable path" case
Martin Wilck [Fri, 2 Nov 2018 12:21:22 +0000 (13:21 +0100)]
multipathd: check_path: improve logging for "unusable path" case

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath: pathinfo: don't blank wwid if checker fails
Martin Wilck [Fri, 2 Nov 2018 12:21:21 +0000 (13:21 +0100)]
libmultipath: pathinfo: don't blank wwid if checker fails

Blanking a WWID is a dangerous operation. E.g. configure() would
consider the path in question as invalid and orphan it if the
WWID is blank. Don't do this checker failures which may be transient
or indicate a badly configured or otherwise malfunctioning checker.
Moreover, we try to determine WWID even if path_offline returns
PATH_DOWN in the first place, so why should we not if the checker
has a problem?

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath: tur checker: leave unsupported paths alone
Martin Wilck [Fri, 2 Nov 2018 12:21:20 +0000 (13:21 +0100)]
libmultipath: tur checker: leave unsupported paths alone

A checker shouldn't set the path state to PATH_DOWN if it fails
to obtain information about the path in the first place. Add logic
to the checker to distinguish a failed path from an unsupported path.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath: rdac checker: leave unsupported paths alone
Martin Wilck [Fri, 2 Nov 2018 12:21:19 +0000 (13:21 +0100)]
libmultipath: rdac checker: leave unsupported paths alone

A checker shouldn't set the path state to PATH_DOWN if it fails
to obtain information about the path in the first place. Add logic
to the checker to distinguish a failed path from an unsupported path.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath: hp_sw checker: leave unsupported paths alone
Martin Wilck [Fri, 2 Nov 2018 12:21:18 +0000 (13:21 +0100)]
libmultipath: hp_sw checker: leave unsupported paths alone

A checker shouldn't set the path state to PATH_DOWN if it fails
to obtain information about the path in the first place. Add logic
to the checker to distinguish a failed path from an unsupported path.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath: clariion checker: leave unsupported paths alone
Martin Wilck [Fri, 2 Nov 2018 12:21:17 +0000 (13:21 +0100)]
libmultipath: clariion checker: leave unsupported paths alone

A checker shouldn't set the path state to PATH_DOWN if it fails
to obtain information about the path in the first place. Add logic
to the checker to distinguish a failed path from an unsupported path.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath/checkers: support unsupported paths
Martin Wilck [Fri, 2 Nov 2018 12:21:16 +0000 (13:21 +0100)]
libmultipath/checkers: support unsupported paths

We should be able to distinguish the case where a checker
determines a path to be positively down from the case where
the checker fails to obtain necessary information, e.g.
because of a configuration problem (wrong checker).
Use PATH_WILD for the latter case, as it's hardly used now.

Provide a generic message for the situation that a path
checker can't handle a certain path.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agomultipathd: improve checker message logging
Martin Wilck [Fri, 2 Nov 2018 12:21:15 +0000 (13:21 +0100)]
multipathd: improve checker message logging

Don't rely on any variables being defined in LOG_MSG.
If message log level is low, don't bother to fetch the message.

Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath/checkers: tur: use message id
Martin Wilck [Fri, 2 Nov 2018 12:21:14 +0000 (13:21 +0100)]
libmultipath/checkers: tur: use message id

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath/checkers: readsector0: use message id
Martin Wilck [Fri, 2 Nov 2018 12:21:13 +0000 (13:21 +0100)]
libmultipath/checkers: readsector0: use message id

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath/checkers: rdac: use message id
Martin Wilck [Fri, 2 Nov 2018 12:21:12 +0000 (13:21 +0100)]
libmultipath/checkers: rdac: use message id

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath/checkers: hp_sw: use message id
Martin Wilck [Fri, 2 Nov 2018 12:21:11 +0000 (13:21 +0100)]
libmultipath/checkers: hp_sw: use message id

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath/checkers: emc_clariion: use message id
Martin Wilck [Fri, 2 Nov 2018 12:21:10 +0000 (13:21 +0100)]
libmultipath/checkers: emc_clariion: use message id

emc_clariion is the only path checker that was using a non-constant
message ("read error" case). This isn't possible with the msgid
approach any more. Use condlog() for the dynamic log message and
simply report "read error" as checker message.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath/checkers: directio: use message id
Martin Wilck [Fri, 2 Nov 2018 12:21:09 +0000 (13:21 +0100)]
libmultipath/checkers: directio: use message id

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath/checkers: cciss_tur: use message id
Martin Wilck [Fri, 2 Nov 2018 12:21:08 +0000 (13:21 +0100)]
libmultipath/checkers: cciss_tur: use message id

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath/checkers: replace message by msgid
Martin Wilck [Fri, 2 Nov 2018 12:21:07 +0000 (13:21 +0100)]
libmultipath/checkers: replace message by msgid

Replace the character array "message" in struct checker with
a "message ID" field.

The generic checker code defines a couple of standard message IDs
and corresponding messages. Checker-specific message IDs start
at CHECKER_FIRST_MSG. Checkers that implement specific message
IDs must provide a table for converting the IDs into actual log
messages.

This simplifies the checker data structure and the handling of
checker messages in the critical checker code path. It comes at
the cost that only constant message strings are supported. It
turns out that only a single checker log message (in the emc_clariion
checker) was dynamically generated, and the missing information can
be provided with a standard condlog message.

Follow-up patches implement this for the existing checkers.

Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath: fix memory leaks from scandir() use
Martin Wilck [Fri, 2 Nov 2018 12:21:06 +0000 (13:21 +0100)]
libmultipath: fix memory leaks from scandir() use

scandir() users must not only free the resulting dirent* array,
but also every member. Add a cleanup function, and fix the
existing users of scandir() in libmultipath.

Add a small helper macro for casting function pointers to the
type pthread_cleanup_push() expects.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath: fix use of uninitialized memory in write()
Martin Wilck [Fri, 2 Nov 2018 12:21:05 +0000 (13:21 +0100)]
libmultipath: fix use of uninitialized memory in write()

valgrind complained about this.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agomultipath.8: fix description of "device" argument
Martin Wilck [Tue, 23 Oct 2018 13:43:48 +0000 (15:43 +0200)]
multipath.8: fix description of "device" argument

Describe the fact that we can refer to path devices by WWID, and
to multipath maps by devnode.

Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agomultipathd: improve "add missing path" handling
Martin Wilck [Tue, 23 Oct 2018 13:43:47 +0000 (15:43 +0200)]
multipathd: improve "add missing path" handling

Only add devices that have been properly initialized by pathinfo().
For others, increase the path check interval to avoid useless checks
of devices which are probably not meant to be multipathed anyway.

The check for pp->initialized != INIT_MISSING_UDEV is redundant,
as check_path() returns early in all other cases. Replace it by a
check for INIT_FAILED, in case we ever add more init states.

Suggested-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agomultipathd: handle repeated udev retrigger failure
Martin Wilck [Tue, 23 Oct 2018 13:43:46 +0000 (15:43 +0200)]
multipathd: handle repeated udev retrigger failure

If a path was still not properly initialized after exhausting the
retrigger tries, it used to remain in INIT_MISSING_UDEV state forever.
get_uid() might fall back to non-udev-based methods to determine
the WWID, but it would never be called for a path in this state any more.

This patch changes this behavior by resetting the path back to FAILED
state if udev can't provide the WWID even after retriggering. Now, if
the path ever happens to be in PATH_UP or PATH_GHOST state again,
pathinfo(DI_ALL) will be called from check_path(), and there's at least
some chance to obtain a WWID for it.

Signed-off-by: Martin Wilck <mwilck@suse.com>
12 months agolibmultipath: handle TUR threads that can't be cancelled
Martin Wilck [Tue, 23 Oct 2018 13:43:45 +0000 (15:43 +0200)]
libmultipath: handle TUR threads that can't be cancelled

When the tur checker code determines that a hanging TUR thread
couldn't be cancelled, rather than simply returning, reallocate
the checker context and start a new thread. This will leak some
memory if the hanging thread never wakes up again, but well, in
that highly unlikely case we're leaking threads anyway.

Signed-off-by: Martin Wilck <mwilck@suse.com>
13 months agolibmultipath: test code for "zombie" TUR threads
Martin Wilck [Wed, 10 Oct 2018 20:05:04 +0000 (22:05 +0200)]
libmultipath: test code for "zombie" TUR threads

This patch adds test code that simulates hanging, non-cancellable
TUR threads, for testing multipathd's behavior in that situation.
Compile libmultipath with CFLAGS=-DTUR_TEST_MAJOR=8 to activate
the test code. Without that flag, the patch has no effect.

Signed-off-by: Martin Wilck <mwilck@suse.com>
13 months agomultipath.8: man page update
Martin Wilck [Wed, 10 Oct 2018 20:05:03 +0000 (22:05 +0200)]
multipath.8: man page update

Clean up the synopsis, listing only combinations of command line switches
that work and make sense. Split the switches between "operation modes"
and options. Fix the documentation of the -v switch, which was wrong.
Move the description of the "device" argument to the top. Link to
multipath.conf(5) for the description of the path grouping policy rather
than repeating the content here. Various minor improvements and clarifications.

Signed-off-by: Martin Wilck <mwilck@suse.com>
13 months agomultipath.rules: add comment about DM_MULTIPATH_DEVICE_PATH=2
Martin Wilck [Wed, 10 Oct 2018 20:05:02 +0000 (22:05 +0200)]
multipath.rules: add comment about DM_MULTIPATH_DEVICE_PATH=2

See dm-devel discussion "Changes in DM_MULTIPATH_DEVICE_PATH in
multipath-tools 0.7.7" (Sep. 2018) for rationale.

Cc: Adam Williamson <awilliam@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
13 months agolibmultipath: cciss_ioctl_pathinfo doesn't fail
Martin Wilck [Wed, 10 Oct 2018 20:05:01 +0000 (22:05 +0200)]
libmultipath: cciss_ioctl_pathinfo doesn't fail

Make it a void function and move the DI_SERIAL test to pathinfo().

Signed-off-by: Martin Wilck <mwilck@suse.com>
13 months agolibmultipath: scsi_ioctl_pathinfo doesn't fail
Martin Wilck [Wed, 10 Oct 2018 20:05:00 +0000 (22:05 +0200)]
libmultipath: scsi_ioctl_pathinfo doesn't fail

This function never returns error, so make a void.
Move the mask test to pathinfo() where it belongs.
The error message about the serial number isn't important
any more, reduce its level to v3.

Signed-off-by: Martin Wilck <mwilck@suse.com>
13 months agotest-kpartx: add test for invocation on image file
Martin Wilck [Wed, 10 Oct 2018 20:04:59 +0000 (22:04 +0200)]
test-kpartx: add test for invocation on image file

Add a test for kpartx invocation on an image file that is not
yet part of a loop device, passing a relative path to kpartx:

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

The recent patches 95c4189b "kpartx: Use absolute paths to create mappings"
and c1adcc5b "kpartx: Use absolute paths to create mappings" both
independently fixed this behavior, which had been broken previously by
9bdfa3eb "kpartx: use absolute path for regular files".

Cc: Stef Walter <stefw@redhat.com>
Cc: Yuval Turgeman <yturgema@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
13 months agomultipath-tools: delete trailing whitespaces
Xose Vazquez Perez [Wed, 10 Oct 2018 19:51:16 +0000 (21:51 +0200)]
multipath-tools: delete trailing whitespaces

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>
13 months agolibmultipath: timeout on unresponsive tur thread
Benjamin Marzinski [Wed, 10 Oct 2018 18:01:13 +0000 (13:01 -0500)]
libmultipath: timeout on unresponsive tur thread

If the tur checker thread has been cancelled but isn't responding,
timeout instead of doing a sync check.  This will keep one bad
device from impacting all of multipathd.

Fixes: 455242d ("libmultipath: fix tur checker timeout")
Cc: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
13 months agompathpersist: fix registration rollback issue
Benjamin Marzinski [Wed, 10 Oct 2018 18:01:12 +0000 (13:01 -0500)]
mpathpersist: fix registration rollback issue

When mpathpersist tries to rollback the registration, it copies
the SARK to the RK, and clears the SARK. However, it repeated this step
for each thread. This means that the first rollback thread correctly
had the RK set to the SARK used during registration. However, if more
than one registration needed to be rolled back, later threads would have
both the RK and SARK cleared. This commit fixes that by only copying and
clearing the SARK once.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
13 months agomultipathd: set return code for multipathd commands
Benjamin Marzinski [Wed, 10 Oct 2018 18:01:11 +0000 (13:01 -0500)]
multipathd: set return code for multipathd commands

Failed multipathd commands should set the return code to 1.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
13 months agolibmultipath: remove max_fds code duplication
Benjamin Marzinski [Wed, 10 Oct 2018 18:01:10 +0000 (13:01 -0500)]
libmultipath: remove max_fds code duplication

Instead of multipath, multipathd, and mpathpersist all having code to
set the max number of open file descriptors, just use a util function to
do it.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>