multipath-tools/.git
17 months agolibmultipath: pathinfo: call into foreign library
Martin Wilck [Mon, 5 Mar 2018 23:15:02 +0000 (00:15 +0100)]
libmultipath: pathinfo: call into foreign library

This actually enables the use of foreign paths.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agolibmultipath/foreign: nvme foreign library
Martin Wilck [Mon, 5 Mar 2018 23:15:01 +0000 (00:15 +0100)]
libmultipath/foreign: nvme foreign library

This still contains stubs for path handling and checking, but it's functional
for printing already.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agolibmultipath/print: add "%G - foreign" wildcard
Martin Wilck [Mon, 5 Mar 2018 23:15:00 +0000 (00:15 +0100)]
libmultipath/print: add "%G - foreign" wildcard

This adds a format field to identify foreign maps as such, and
uses it in default-formatted topology output (generic_style()).

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agolibmultipath: API for foreign multipath handling
Martin Wilck [Mon, 5 Mar 2018 23:14:59 +0000 (00:14 +0100)]
libmultipath: API for foreign multipath handling

Add an API for "foreign" multipaths. Foreign libraries are loaded
from ${multipath_dir}/libforeign-*.so, as we do for checkers.

Refer to "foreign.h" for details about the API itself. Like we do for
checkers, high-level multipath code isn't supposed to call the API directly,
but rather the wrapper functions declared in "foreign.h".

This API is used only for displaying information and for logging. An extension to
other functionality (such as monitoring or administration) might be feasible,
but is not planned.

Foreign libraries communicate with libmultipath through the API defined in
"foreign.h". The foreign library can implement multipath maps, pathgroups,
and paths as it likes, they just need to provide the simple interfaces
defined in "generic.h" to libmultipath. These interfaces are used in libmultipath's
"print" implementation to convey various bits of information to users. By
using the same interfaces for printing that libmultipath uses internally,
foreign library implementations can focus on the technical side without
worrying about output formatting compatibility.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agolibmultipath: print: use generic API for get_x_layout()
Martin Wilck [Mon, 5 Mar 2018 23:14:58 +0000 (00:14 +0100)]
libmultipath: print: use generic API for get_x_layout()

Introduce new functions _get_path_layout and _get_multipath_layout
using the new "generic" API to determine field widths, and map the
old API to them.

Furthermore, replace the boolean "header" by an enum with 3 possible
values. The new value LAYOUT_RESET_NOT allows calling the get_x_layout
function several times and determine the overall field width.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agolibmultipath: print: convert API to generic data type
Martin Wilck [Mon, 5 Mar 2018 23:14:57 +0000 (00:14 +0100)]
libmultipath: print: convert API to generic data type

Convert higher level API (snprint_multipath_topology() etc) to
using the generic multipath API. This will allow "foreign"
multipath objects that implement the generic API to be printed
exactly like native multipathd objects.

The previous API (using "struct multipath*" and "struct path" remains
in place through macros mapping to the new functions. By doing this
and testing in regular setups, it's easily verified that the new
API works and produces the same results.

Moreover, abstract out the code to determine the output format from multipath
properties into snprint_multipath_style(), to be able to use it as generic
->style() method.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agolibmultipath: "generic multipath" interface
Martin Wilck [Mon, 5 Mar 2018 23:14:56 +0000 (00:14 +0100)]
libmultipath: "generic multipath" interface

This patch adds a simplified abstract interface to the multipath data structures.
The idea is to allow "foreign" data structures to be treated by libmultipath
if they implement the same interface. Currently, the intention is to use this
only to provide formatted output about from this interface.

This interface assumes only that the data structure is organized in maps
containing path groups containing paths, and that formatted printing (using
the wildcards defined in libmultipath) is possible on each level of the data
structure.

The patch also implements the interface for the internal dm_multipath data
structure.

The style() method looks a bit exotic, but it's necessary because
print_multipath_topology() uses different formats depending on the mpp
properties. This needs to be in the generic interface, too, if we want to
produce identical output.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agolibmultipath: add vector_convert()
Martin Wilck [Mon, 5 Mar 2018 23:14:55 +0000 (00:14 +0100)]
libmultipath: add vector_convert()

This is a handy helper for creating one vector from another,
mapping each element of the origin vector to an element of
the target vector with a given conversion function. It can
also be used to "concatenate" vectors by passing in a non-NULL first
argument.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agolibmultipath: add vector_free_const()
Martin Wilck [Mon, 5 Mar 2018 23:14:54 +0000 (00:14 +0100)]
libmultipath: add vector_free_const()

... to dispose of constant vectors (const struct _vector*).

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agomultipath-tools: Makefile.inc: use -Werror=cast-qual
Martin Wilck [Mon, 5 Mar 2018 23:14:53 +0000 (00:14 +0100)]
multipath-tools: Makefile.inc: use -Werror=cast-qual

Casting "const" away is often an indicator for wrong code.
Add a compiler flag to warn about such possible breakage.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agolibmultipath: fix compiler warnings for -Wcast-qual
Martin Wilck [Mon, 5 Mar 2018 23:14:52 +0000 (00:14 +0100)]
libmultipath: fix compiler warnings for -Wcast-qual

Fix the warnings that were caused by adding the -Wcast-qual compiler
flag in the previous patch.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agolibmultipath: use "const" in devmapper code
Martin Wilck [Mon, 5 Mar 2018 23:14:51 +0000 (00:14 +0100)]
libmultipath: use "const" in devmapper code

Improve use of "const" qualifiers in libmultipath's devmapper code.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agolibmultipath/print: use "const" where appropriate
Martin Wilck [Mon, 5 Mar 2018 23:14:50 +0000 (00:14 +0100)]
libmultipath/print: use "const" where appropriate

Convert the print.h/print.c code to use "const" qualifiers
properly. This is generally considered good programming practice,
and the printing code shouldn't change any objects anyway.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agolibmultipath: don't update path groups when printing
Martin Wilck [Mon, 5 Mar 2018 23:14:49 +0000 (00:14 +0100)]
libmultipath: don't update path groups when printing

Updating the prio values for printing makes no sense. The user wants to see
the prio values multipath is actually using for path group selection, and
updating the values here means actually lying to the user if the prio values
have changed, but multipathd hasn't updated them internally.

If we really don't update the pathgroup prios when we need to, this should be
fixed elsewhere. The current wrong output would just hide that if it occured.

Moreover, correctness forbids changing properties so deeply in a code path
that's supposed to print them only. Finally, this piece of code prevents the
print.c code to be converted to proper "const" usage.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agolibmultipath: parser: use call-by-value for "snprint" methods
Martin Wilck [Mon, 5 Mar 2018 23:14:48 +0000 (00:14 +0100)]
libmultipath: parser: use call-by-value for "snprint" methods

Convert the snprint methods for all keywords to call-by-value,
and use "const" qualifier for the "data" argument. This makes sure
that "snprint" type functions don't modify the data they're print,
helps compile-time correctness checking, and allows more proper
"const" cleanups in the future.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agolibmultipath: get rid of selector "hack" in print.c
Martin Wilck [Mon, 5 Mar 2018 23:14:47 +0000 (00:14 +0100)]
libmultipath: get rid of selector "hack" in print.c

By properly linking the path groups with their parent multipath,
we don't need this "hack" any more.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agolibmultipath: remove unused "stdout helpers"
Martin Wilck [Mon, 5 Mar 2018 23:14:46 +0000 (00:14 +0100)]
libmultipath: remove unused "stdout helpers"

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agomultipath(d)/Makefile: add explicit dependency on libraries
Martin Wilck [Mon, 5 Mar 2018 23:14:45 +0000 (00:14 +0100)]
multipath(d)/Makefile: add explicit dependency on libraries

Otherwise the binaries won't be re-linked if the libraries change.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agomultipath-tools: add INSPUR/MCS to hardware table
Tom Geng(耿芳忠) [Mon, 29 Jan 2018 06:04:29 +0000 (06:04 +0000)]
multipath-tools: add INSPUR/MCS to hardware table

Hi, Xose,
I sent the patch to dm-devel last week, but forgot to CC you. Please help to
review and have chance to submit to the mainline.
Thank you a lot.

From 091bae5fec22c61f0c3e6f9ab848fecae5203122 Mon Sep 17 00:00:00 2001
From: Tom Geng <gengfangzhong@inspur.com>
Date: Tue, 23 Jan 2018 15:33:09 +0800
Subject: [PATCH] multipath-tools: add INSPUR/MCS to hardware table

17 months agomultipath: print sysfs state in fast list mode
Benjamin Marzinski [Tue, 13 Feb 2018 03:42:14 +0000 (21:42 -0600)]
multipath: print sysfs state in fast list mode

commit b123e711ea2a4b471a98ff5e26815df3773636b5 "libmultipath: cleanup
orphan device states" stopped multipathd from showing old state for
orphan paths by checking if pp->mpp was set, and only printing the state
if it was.   Unfortunately, when "multipath -l" is run, pp->mpp isn't
set. While the checker state isn't checked and shouldn't be printed with
"-l", the sysfs state can be, and was before b123e711. This patch sets
pp->mpp in fast list mode, so that the sysfs state gets printed. It
also verifies that the path exists in sysfs, and if not, marks it as
faulty.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agomultipathd: change spurious uevent msg priority
Benjamin Marzinski [Tue, 13 Feb 2018 03:42:13 +0000 (21:42 -0600)]
multipathd: change spurious uevent msg priority

The "spurious uevent, path already in pathvec" is not anything to worry
about, so it should not have the error priority.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agoFix set_no_path_retry() regression
Benjamin Marzinski [Tue, 13 Feb 2018 03:42:12 +0000 (21:42 -0600)]
Fix set_no_path_retry() regression

commit 0f850db7fceb6b2bf4968f3831efd250c17c6138 "multipathd: clean up
set_no_path_retry" has a bug in it. It made set_no_path_retry
never reset mpp->retry_ticks, even if the device was in recovery mode,
and there were valid paths. This meant that adding new paths didn't
remove a device from recovery mode, and queueing could get disabled,
even while there were valid paths. This patch fixes that.

This patch also fixes a bug in cli_restore_queueing() and
cli_restore_all_queueing(), where a device that had no_path_retry
set to "queue" would enter recovery mode (although queueing would
never actually get disabled).

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agomultipathd: remove unused configure parameter
Benjamin Marzinski [Tue, 13 Feb 2018 03:42:11 +0000 (21:42 -0600)]
multipathd: remove unused configure parameter

configure() is always called with start_waiters=1, so there is no point
in having the parameter. Remove it.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agomultipathd: remove coalesce_paths from ev_add_map
Benjamin Marzinski [Tue, 13 Feb 2018 03:42:10 +0000 (21:42 -0600)]
multipathd: remove coalesce_paths from ev_add_map

If ev_add_map is called for a multipath device that doesn't exist in
device-mapper, it will call coalesce_paths to add it.  This doesn't work
and hasn't for years. It doesn't add the map to the mpvec, or start up
waiters, or do any of the necessary things that do get done when you
call ev_add_map for a map that does exist in device mapper.

Fortunately, there are only two things that call ev_add_map. uev_add_map
makes sure that the device does exist in device-mapper before calling
ev_add_map, and cli_add_map creates the device first and then calls
ev_add_map, if the device doesn't exist.

So, there is no reason for coalesce_paths to be in ev_add_map. This
removes it.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agomultipath: fix DEF_TIMEOUT use
Benjamin Marzinski [Tue, 13 Feb 2018 03:42:09 +0000 (21:42 -0600)]
multipath: fix DEF_TIMEOUT use

DEF_TIMEOUT is specified in seconds. The io_hdr timeout is specified in
milliseconds, so we need to convert it. Multipath should be waiting
longer than 30 milliseconds here. If there are concerns that 30 seconds
may be too long, we could always make this configurable, using
conf->checker_timeout if set.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agolibmultipath: fix tur checker locking
Benjamin Marzinski [Tue, 13 Feb 2018 03:42:08 +0000 (21:42 -0600)]
libmultipath: fix tur checker locking

Commit 6e2423fd fixed a bug where the tur checker could cancel a
detached thread after it had exitted. However in fixing this, the new
code grabbed a mutex (to call condlog) while holding a spin_lock.  To
deal with this, I've done away with the holder spin_lock completely, and
replaced it with two atomic variables, based on a suggestion by Martin
Wilck.

The holder variable works exactly like before.  When the checker is
initialized, it is set to 1. When a thread is created it is incremented.
When either the thread or the checker are done with the context, they
atomically decrement the holder variable and check its value. If it
is 0, they free the context. If it is 1, they never touch the context
again.

The other variable has changed. First, ct->running and ct->thread have
switched uses. ct->thread is now only ever accessed by the checker,
never the thread.  If it is non-NULL, a thread has started up, but
hasn't been dealt with by the checker yet. It is also obviously used
by the checker to cancel the thread.

ct->running is now an atomic variable.  When the thread is started
it is set to 1. When the checker wants to kill a thread, it atomically
sets the value to 0 and reads the previous value.  If it was 1,
the checker cancels the thread. If it was 0, the nothing needs to be
done.  After the checker has dealt with the thread, it sets ct->thread
to NULL.

Right before the thread finishes and pops the cleanup handler, it
atomically sets the value of ct->running to 0 and reads the previous
value. If it was 1, the thread just pops the cleanup handler and exits.
If it was 0, then the checker is trying to cancel the thread, and so the
thread calls pause(), which is a cancellation point.

Cc: Martin Wilck <mwilck@suse.com>
Cc: Bart Van Assche <Bart.VanAssche@wdc.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
17 months agomultipath-tools: handle exit signal immediately
Martin Wilck [Tue, 30 Jan 2018 14:16:24 +0000 (15:16 +0100)]
multipath-tools: handle exit signal immediately

multipathd shouldn't try to service any more client connections
when it receives an exit signal. Moreover, ppoll() can return
success even if signals occured. So check for reconfigure or
log_reset signals after handling pending client requests.

Based on an analysis by Chongyun Wu.

Reported-by: Chongyun Wu <wu.chongyun@h3c.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agolibmultipath: increase path product_id/rev field size for NVMe
Martin Wilck [Fri, 19 Jan 2018 11:55:35 +0000 (12:55 +0100)]
libmultipath: increase path product_id/rev field size for NVMe

NVMe allows longer strings for the model (product) and firmware rev
than SCSI.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agomultipath-tools: add dependency tracking to Makefiles
Martin Wilck [Fri, 19 Jan 2018 00:19:44 +0000 (01:19 +0100)]
multipath-tools: add dependency tracking to Makefiles

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agolibmultipath: ignore natively multipathed NVME devices
Martin Wilck [Fri, 19 Jan 2018 00:19:43 +0000 (01:19 +0100)]
libmultipath: ignore natively multipathed NVME devices

Such devices have a parent with SUBSYSTEM="nvme-subsystem", not "nvme".
Furthermore, avoid a possible segfaults NULL checks.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agomultipath.rules: handle NVME devices
Martin Wilck [Fri, 19 Jan 2018 00:19:42 +0000 (01:19 +0100)]
multipath.rules: handle NVME devices

Note: ID_WWN is set in 60-persistent-storage.rules in current systemd.
That won't work well together with us installing multipath.rules as
56-multipath.rules -  multipath -u won't see ID_WWN.

However, we have strong reasons to run before blkid is invoked.
ID_WWN determination for NVMe should be moved to an earlier udev rule.
See systemd pull request #7594 on github.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agomultipathd: ignore uevents for non-mpath devices
Martin Wilck [Mon, 29 Jan 2018 23:57:50 +0000 (00:57 +0100)]
multipathd: ignore uevents for non-mpath devices

multipathd can't deal with other devices anyway. Proceeding further
with events for other devices just generates log noise.

Based on an idea from Ritika Srivastava <ritika.srivastava@oracle.com>.
("multipath-tools: Skip CHANGE uevent for non-mpath devices").

Changes in v2: always return immediately for non-mpath case
  (Ritika Srivastava)

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agolibmultipath: add uevent_is_mpath
Martin Wilck [Wed, 17 Jan 2018 07:49:38 +0000 (08:49 +0100)]
libmultipath: add uevent_is_mpath

This function can be used to test if an uevent belongs to valid
multipath device. Unit tests are also added.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agolibmultipath: move UUID_PREFIX to devmapper.h
Martin Wilck [Wed, 17 Jan 2018 07:49:37 +0000 (08:49 +0100)]
libmultipath: move UUID_PREFIX to devmapper.h

This constant is useful elsewhere, too.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agolibmultipath: const qualifier for wwid and alias
Martin Wilck [Wed, 17 Jan 2018 07:49:36 +0000 (08:49 +0100)]
libmultipath: const qualifier for wwid and alias

Add "const" qualifiers to some function arguments and fields,
in order to tidy up const handling of libmultipath.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agolibmultipath: refactor uevent_get_XXX
Martin Wilck [Wed, 17 Jan 2018 07:49:35 +0000 (08:49 +0100)]
libmultipath: refactor uevent_get_XXX

Use common helper functions for uevent_get_XXX.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agotests: cmocka-based unit test for uevent_get_XXX
Martin Wilck [Wed, 17 Jan 2018 07:49:34 +0000 (08:49 +0100)]
tests: cmocka-based unit test for uevent_get_XXX

This patch starts a simple unit test framework for multipath-tools
based on the cmocka framework (https://cmocka.org/). As a start,
it adds unit tests for the uevent_get_XXX set of functions.

Note that some tests currently fail. This will be fixed by the
following patches.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agoassemble_map: no newline at end of params string
Martin Wilck [Wed, 17 Jan 2018 07:49:33 +0000 (08:49 +0100)]
assemble_map: no newline at end of params string

This newline is superfluous for device-mapper, and causes ugly
debug output.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agomultipathd: release uxsocket and resource when cancel thread
Wuchongyun [Wed, 17 Jan 2018 08:15:05 +0000 (08:15 +0000)]
multipathd: release uxsocket and resource when cancel thread

Hi Matin,
I think it's a good idea to move the close(ux_sock) call further up to avoid new clients trying to connect, Below is the new patch for your comment. Please help to review. Thanks.

Issue description: we meet this issue: when multipathd initilaze and
call uxsock_listen to create unix domain socket, but return -1 and
the errno is 98 and then the uxsock_listen return null. After multipathd
startup we can't receive any user's multipathd commands to finish the
new multipath creation or any operations any more!

We found that uxlsnr thread's cleanup function not close the sockets
also not release the clients when cancel thread, the domain socket
will be release by the system. In any special environment like the
machine's load is very heavy or any situations, the system may not close
the old domain socket when we try to create and bind the new domain
socket may return errno:98(Address already in use).

And also we make some experiments:
in uxsock_cleanup if we close the ux_sock first and then immdediately
call ux_socket_listen to create new ux_sock and initialization will be
OK; if we don't close the ux_sock and call ux_socket_listen will return
-1 and errno = 98.

So we believe that close uxsocket and release clients  when cancel
thread can make sure of that new starting multipathd thread can
create new uxsocket successfully, also can receive multipathd commands
properly. And this path can fix clients' memory leak too.

Signed-off-by: Chongyun Wu <wu.chongyun@h3c.com>
17 months agolibmultipath: path latency: remove warnings
Martin Wilck [Sat, 13 Jan 2018 21:19:38 +0000 (22:19 +0100)]
libmultipath: path latency: remove warnings

The warnings at here are pointless. We are looking at a single
path only. Firstly, the standdard deviation for this measurement
can't be "too low" - the lower, the more precise the measurement,
the better. Secondly, a high standard deviation indicates an
unstable path with highly variable latency. Not good, but nothing
to warn about here.

What matters for the selection of "base_num" is not how a single
path behaves, but how different paths of the same path group relate
to each other, which we don't know at this point at the code.

What we want to avoid is too fine a differentiation, in particular
in combination with group_by_prio, because we'd loose the ability for
load balancing. But this is rather a topic for the man page or a
"best practices" document.

17 months agolibmultipath: path latency: simplify getprio()
Martin Wilck [Sat, 13 Jan 2018 21:19:37 +0000 (22:19 +0100)]
libmultipath: path latency: simplify getprio()

The log standard deviation can be calculated much more simply
by realizing

   sum_n (x_i - avg(x))^2 == sum_n x_i^2 - n * avg(x)^2

Also, use timespecsub rather than the custom timeval_to_usec,
and avoid taking log(0).

17 months agolibmultipath: path latency: log threshold with p2
Martin Wilck [Sat, 13 Jan 2018 21:19:36 +0000 (22:19 +0100)]
libmultipath: path latency: log threshold with p2

This is not a critical error. It just means that the path in
question will have low priority (rightly so, if it has >100s latency).

17 months agolibmultipath: path latency: fix default base num
Martin Wilck [Sat, 13 Jan 2018 21:19:35 +0000 (22:19 +0100)]
libmultipath: path latency: fix default base num

I don't think anyone can measure latency to 1% accuracy. It's
better to not even pretend to be able to. 10% should be fine
even for the most latency-critical environments.

17 months agomultipathd.service: set TasksMax=infinity
Martin Wilck [Sat, 13 Jan 2018 21:19:34 +0000 (22:19 +0100)]
multipathd.service: set TasksMax=infinity

Systemd 228 introduced a global task limit of 512 for system services.
System 231 changed this to 15% of pid_max, or 4915.
In particular the one of systemd 228 is too low for multipathd with
many LUNs. Use TasksMax=infinity to overcome this limitation.

17 months agotest-kpartx: add test for mapping without UUID
Martin Wilck [Sat, 13 Jan 2018 21:19:33 +0000 (22:19 +0100)]
test-kpartx: add test for mapping without UUID

kpartx shouldn't remove these mappings.

17 months agomultipathd: fix compiler warning for uev_pathfail_check
Martin Wilck [Sat, 13 Jan 2018 21:19:32 +0000 (22:19 +0100)]
multipathd: fix compiler warning for uev_pathfail_check

gcc7 spits out an indentation warning for this function.

Fixes: 8392431 "multipath-tools: check null path before handle path-failed event"

17 months agomultipathd.service: drop Before=lvm2-lvmetad.service
Martin Wilck [Sat, 13 Jan 2018 21:19:31 +0000 (22:19 +0100)]
multipathd.service: drop Before=lvm2-lvmetad.service

lvm2-lvmetad does not depend on multipathd. On the contrary,
when multipathd sets up a map that contains LVM PVs, it's good
if lvm2-lvmetad is already running.

17 months agomultipathd.socket: add WantedBy=sockets.target
Martin Wilck [Sat, 13 Jan 2018 21:19:30 +0000 (22:19 +0100)]
multipathd.socket: add WantedBy=sockets.target

Without this, "systemctl enable multipathd.service" spits out
an error message.

17 months agokpartx.rules: fix by-id/scsi-* for user_friendly_names
Martin Wilck [Sat, 13 Jan 2018 21:19:29 +0000 (22:19 +0100)]
kpartx.rules: fix by-id/scsi-* for user_friendly_names

With user_friendly names (or generally, with aliases), the udev
rules create /dev/disk/by-id/scsi-${ALIAS} rather than
/dev/disk/by-id/scsi-${ID_SERIAL}. Fix that.

17 months agomultipath -C: decrease log level
Martin Wilck [Sat, 13 Jan 2018 21:19:28 +0000 (22:19 +0100)]
multipath -C: decrease log level

Avoid that the positive case ("usable paths found") spams the
syslog on systems with many LUNs.

17 months agolibmultipath: hwtable: no_path_retry="queue" for NetApp NVMe
Martin Wilck [Tue, 23 Jan 2018 17:07:04 +0000 (18:07 +0100)]
libmultipath: hwtable: no_path_retry="queue" for NetApp NVMe

Netapp requested this default setting for NetApp E-Series NVMe in addition to "multibus".
Also, finalize the product ID regex after consulting with NetApp (the FW reporting just
"ONTAP Controller" was beta only).

This obsoletes my previous "FIX" patch
'FIX "libmultipath: hwtable: multibus for NetApp NVMe-FC'

Fixes: "libmultipath: hwtable: multibus for NetApp NVMe-FC"
Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agolibmultipath: hwtable: multibus for NetApp NVMe-FC
Martin Wilck [Sat, 13 Jan 2018 21:19:27 +0000 (22:19 +0100)]
libmultipath: hwtable: multibus for NetApp NVMe-FC

Use multibus policy for NetApp NVMe-FC namespace controllers.
The search logic in find_hwe() looks for vendor/product matches backwards, and
quits if a match is found. Therefore specific sub-entries of a generic entry
have to be listed below the generic ones. Therefore, pull the generic NVME
entry with ".*" product name match on top. The NetApp-specific one is put
into the NetApp section. This way, more vendor-specific exceptions for NVME
may be added later.

17 months agolibmultipath: select ALUA prioritizer for RDAC arrays only
Martin Wilck [Sat, 13 Jan 2018 21:19:26 +0000 (22:19 +0100)]
libmultipath: select ALUA prioritizer for RDAC arrays only

Since commit 7e2f46d3, multipathd with "detect_prio" setting (=default)
chooses ALUA prioritizer rather than sysfs prioritizer for arrays with
implicit TPGS. But the intention of that patch was to choose ALUA for
NetApp E-Series (RDAC) storage arrays *only*, not for every array
with implicit TPGS.

17 months agolibmultipath: get_vpd_sgio: support VPD 0xc9
Martin Wilck [Sat, 13 Jan 2018 21:19:25 +0000 (22:19 +0100)]
libmultipath: get_vpd_sgio: support VPD 0xc9

This VPD is needed to check for NetApp E-Series RDAC support.

17 months agolibmultipath: sgio_get_vpd: add page argument
Martin Wilck [Sat, 13 Jan 2018 21:19:24 +0000 (22:19 +0100)]
libmultipath: sgio_get_vpd: add page argument

get_vpd_sgio() assumes to be able to send different VPD inquires.
This requires passing the pg argument to sgio_get_vpd().

17 months agolibmultipath: fix return code of sgio_get_vpd()
Martin Wilck [Sat, 13 Jan 2018 21:19:23 +0000 (22:19 +0100)]
libmultipath: fix return code of sgio_get_vpd()

This function must return the length of data received in success
case.

17 months agolibmultipath: fix return code of sysfs_get_timeout
Martin Wilck [Sat, 13 Jan 2018 21:19:22 +0000 (22:19 +0100)]
libmultipath: fix return code of sysfs_get_timeout

This function should return 1 on success, as the other sysfs_get_XXX
functions. The callers actually expect this - therefore timeout values
from sysfs are never used.

17 months agolibmultipath: condlog: log to stderr
Martin Wilck [Sat, 13 Jan 2018 21:19:21 +0000 (22:19 +0100)]
libmultipath: condlog: log to stderr

Calling 'multipath' might result in various error messages, all
of which should be directed to stderr.
Having them intermixed with the actual output on stdout makes
parsing really hard.

Signed-off-by: Martin Wilck <mwilck@suse.com>
17 months agomultipath: delegate dangerous commands to multipathd
Martin Wilck [Sat, 13 Jan 2018 21:19:20 +0000 (22:19 +0100)]
multipath: delegate dangerous commands to multipathd

Some multipath commands are dangerous to run while multipathd is running.
For example, "multipath -r" may apply a modified configuration to the kernel,
while multipathd is still using the old configuration, leading to
inconsistent state between multipathd and the kernel.

It is safer to use equivalent multipathd client commands instead.
For now, do this only for "multipath -r", but other invocations
may be added in the future. Perhaps some day, all "multipath"
commands will be mapped to multipathd actions.

Note that with delegation, "multipath -r" will not produce any
terminal output, so this may affect users who capture "multipath -r"
output for parsing it. It would be very hard to produce compatible output
to the normal multipath command for different verbosity levels. I
considered running "show topology" after "reconfigure", but the output
would have slightly different format and would only match -v2, anyway.

I plan to convert more multipath commands, but that needs some more
thought. Some additional multipathd client commands need to be
implemented first.

Changes wrt v2:
 - use libmpathcmd rather than exec'ing multipathd (Ben Marzinski)
 - pass more parameters from main program, preparing for other commands

17 months agolibmultipath: don't try to set hwhandler if it is retained
Martin Wilck [Sat, 13 Jan 2018 21:19:19 +0000 (22:19 +0100)]
libmultipath: don't try to set hwhandler if it is retained

Setting a device handler only works if retain_attached_hw_handler
is 'no', or if the kernel didn't auto-assign a handler. If this
is not the case, don't even attempt to set a different handler.

This requires reading the sysfs "dh_state" path attribute.

19 months agolibmultipath: don't update path queueing on reload
Benjamin Marzinski [Wed, 13 Dec 2017 18:08:07 +0000 (12:08 -0600)]
libmultipath: don't update path queueing on reload

With the fix to the features handling code, the multipath device should
already be reloaded with the correct value for queue_if_no_path, so
there's no need to go reset it immediately afterwards.

Cc: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
19 months agomultipathd: marginal path code fixes
Benjamin Marzinski [Thu, 7 Dec 2017 18:49:06 +0000 (12:49 -0600)]
multipathd: marginal path code fixes

There are a couple of issues I noticed with the marginal paths code.

In hit_io_err_recheck_time() there are some problems with the initial
checks. We should always recover the path if there are no other usable
paths to the device, so this check should be first. Also, we just
checked that io_err_disable_reinstate isn't zero before calling this
function, so we don't need to check again here (and it doesn't make any
sense to continue disabling the path if io_err_disable_reinstate is set
to zero).  Finally, the only kind of errors we can get while calling
clock_gettime() are going to happen on every call. So, if we can't get
the time, assume that the timeout has passed.

The multipath.conf.5 description of marginal_path_err_sample_time,
states that sampling is stopped for marginal_path_err_rate_threshold
seconds, when it should be marginal_path_err_recheck_gap_time
seconds.

Lastly, there is a race that can cause multipathd to access freed memory
on shutdown. io_err_stat_thr is started as a detached thread. This means
that stop_io_err_stat_thread() can't know when it has actually stopped,
after pthread_cancel() and pthread_kill() are called. To be safe, it
should not start the thread in a deteched state, and call join to verify
that it has stopped before freeing the memory it uses.  But more
importantly, stop_io_err_stat_thread() was being called before the
checker and uevent threads were being canceled. Both of these threads
access data that is freed in stop_io_err_stat_thread(). To avoid the
chance of these threads accessing freed memory, child() should wait
until these threads are stopped before calling
stop_io_err_stat_thread().

Cc: Guan Junxiong <guanjunxiong@huawei.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
19 months agomultipath: check failed path dmstate in check_path
Benjamin Marzinski [Thu, 7 Dec 2017 18:49:05 +0000 (12:49 -0600)]
multipath: check failed path dmstate in check_path

If a path's checker state is down before and after a path check, but the
path's dmstate is active, mutipath won't update the dmstate. It only
updates the dmstate when the path first fails.  This can cause the
kernel to try known faulty paths, if the multipath device was reloaded
outside of multipathd.  check_path() already checks for and deals with a
similar case where the path's checker state is up before and after a
path check, but the dmstate is failed.  It should do the same thing for
faulty paths.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
19 months agomultipathd: clean up set_no_path_retry
Benjamin Marzinski [Thu, 7 Dec 2017 18:49:04 +0000 (12:49 -0600)]
multipathd: clean up set_no_path_retry

set_no_path_retry() was always updating the queue_if_no_path setting,
even if it was unnecessary.  This caused problems when no_path_retry was
set to a number, where any time __setup_multipath() was called with
reset, queuing automatically restarted, even if there were no usable
paths.

Instead, set_no_path_retry() should just fix the queueing if it is set
to an incorrect value.  This is simple to detect if no_path_retry is set
to "queue" or "fail".  When it is set to a number, multipathd needs to
see if there are usable paths. If so, queueing should be enabled.  If
not, queueing may be either enabled or disabled, but if it is enabled
and the device isn't already in recovery mode, it should be.

Also, calling dm_map_present() is pointless in __setup_multipath(),
since the existence of the map was just checked in dm_get_info().

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
19 months agomultipathd: move recovery mode code to function
Benjamin Marzinski [Thu, 7 Dec 2017 18:49:03 +0000 (12:49 -0600)]
multipathd: move recovery mode code to function

Instead of having multiple functions all running slightly different
code to move a multipath device to recovery mode, there is now
an enter_recovery_mode() function that all of them call.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
19 months agolibmultipath: __setup_multipath param cleanup
Benjamin Marzinski [Thu, 7 Dec 2017 18:49:02 +0000 (12:49 -0600)]
libmultipath: __setup_multipath param cleanup

setup multipath is only called by the daemon, so there is no point in
the is_daemon parameter.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
19 months agomultipathd: remove select_* from setup_multipath
Benjamin Marzinski [Thu, 7 Dec 2017 18:49:01 +0000 (12:49 -0600)]
multipathd: remove select_* from setup_multipath

select_rr_weight() and select_pgfailback() don't need to be set each
time setup_multipath is called, since nothing ever changes the value
of the multipath variable that they set.

select_flush_on_last_del() and select_no_path retry() are a little more
involved.  In multipathd, it is possible to override no_path_retry by
either setting flush_on_last_del, or by manually running the
"disablequeueing" mutipathd command. Queueing gets restored when a path
gets added back to the multipath device. This was done by moving the
select_* functions into setup_multipath, where they frequently get
called unnecessarily.  select_flush_on_last_del() can get removed by
simply using another variable besides flush_on_last_del to track wether
or not we should be force queueing to be disabled.

Since it's only possible to change whether or not you have queueing
force disabled by reloading the device with path, or by manually
restoring it, there is no reason to call select_no_path_retry() on every
call to setup_multipath

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
19 months agomultipathd: fix device creation issues
Benjamin Marzinski [Thu, 7 Dec 2017 18:49:00 +0000 (12:49 -0600)]
multipathd: fix device creation issues

Right now, devices created by multipath and added to multipthd via
ev_add_map() are setup up incorrectly until the first time they get
reloaded.  setup_map() is not run on these devices, which means that all
of the multipath variables set up there don't get initialized until a
later reload.  Also, adopt_paths is run to pull in any paths that the
device is missing, but the device is never reloaded afterwards, so these
paths aren't used.

Now, add_map_without_path() sets up the basic multipath device variables
and then calls update_map() to finish the setup and reload the device.
This patch also moves the code in __setup_multipath(), that only existed
to handle adding devices via ev_add_map(), to where it belongs.

However, it is possible to create a device with no paths, which means
the device cannot know which hwentry to use for its device
configuration.  __setup_multipath() used to help with this via
extract_hwe_from_path(), which grabbed the hwentry from a path if the
multipath device didn't already have it set. This is now done both when
paths are added or the map is updated, which means that
extract_hwe_from_path() runs before the device is configured in
setup_map() instead of after the table has already been loaded. This is
a good thing. But because of this, it can't check the dmstate or the
pathgroup state.  I don't believe it's necessary to care what state the
path is in, especially now that we use libudev. The vendor and product
information gets cached by libudev when the path device is first added,
and should remain the same regardless of whether or not the device is
currently up.  My version does try to take the hwe information from a
path in the PATH_UP state first, but this is mostly to satisfy the
paranoia of the old version.

Also, map_discovery(), which creates multipath devices during multipathd
startup and reconfiguration, that only exist to see if multipathd needs
to reload the device table, called __setup_multipath() as well. Even
after removing the unnecessary code from __setup_multpiath, that still
does pointless work for these devices, which will be removed before the
end of configure(). Now, map_discovery() just gets the necessary kernel
information to make the correct call in select_action().

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
19 months agomultipathd: move helper functions to libmultipath
Benjamin Marzinski [Thu, 7 Dec 2017 18:48:59 +0000 (12:48 -0600)]
multipathd: move helper functions to libmultipath

This commit simply moves sync_map_state() and update_map() from
multipathd/main.c to libmultipath/structs_vec.c, to enable future
changes.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
19 months agolibmultipath: cleanup features handling code
Benjamin Marzinski [Thu, 7 Dec 2017 18:48:58 +0000 (12:48 -0600)]
libmultipath: cleanup features handling code

Right now multipath does some extra work to set the values for
no_path_retry and retain_hwhandler on existing maps it reads in from the
kernel.  This is so that select_action() can use these values to see if
it needs to reload the devices. However, the way it works, the
queue_if_no_path feature isn't always set correctly, and multipath has
to go back afterwards and reset the value anyways.

It's simpler for select_action to just look at the values in the
features line it read in from the kernel and the features line it would
like the new map to have.  By comparing these, it also avoids the
problem where the no_path_retry values match, so it doesn't reload, but
the actual queue_if_no_path feature value is incorrect, so it has to go
back and reset it. It can also skip calling setup_feature() entirely.

To do this, assemble_map() needs to update mp->features. This would
otherwise partially happen when it had to reset the queue_if_no_path
value.  retain_attached_hw_handler was never getting updated before, so
the output when you created a map was incorrect.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
19 months agomultipath: fix hwhandler check in select_action
Benjamin Marzinski [Thu, 7 Dec 2017 18:48:57 +0000 (12:48 -0600)]
multipath: fix hwhandler check in select_action

If the existing multipath table does not have a hardware handler set,
then even if retain_hwhandler is enabled on the new table, it may still
be possible to set the hardware handler on reload. So, adding a
hardware handler to the table should trigger a reload in this case.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
19 months agokpartx: don't delete partitions from partitions
Benjamin Marzinski [Thu, 7 Dec 2017 18:48:56 +0000 (12:48 -0600)]
kpartx: don't delete partitions from partitions

The current del-part-nodes rules try to run partx on the partitions
themselves, which will ofen fail with an error in the log, because the
partitions will have been deleted before partx can run on them.

Cc: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
19 months agomultipath: add "ghost_delay" parameter
Benjamin Marzinski [Thu, 7 Dec 2017 18:48:55 +0000 (12:48 -0600)]
multipath: add "ghost_delay" parameter

If the lower-priority passive paths for a multipath device appear first,
IO can go to them and cause the hardware handler to activate them,
before the higher priority paths appear, causing the devices to
failback. Setting the "ghost_delay" parameter to a value greater than
0 can avoid this ping-ponging by causing udev to not mark the device as
Ready after its initial creation until either an active path appears,
or ghost_delay seconds have passed. Multipathd does this by setting
the MPATH_UDEV_NO_PATHS_FLAG.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
19 months agomultipath-tools: check null path before handle path-failed event
Guan Junxiong [Mon, 4 Dec 2017 13:15:50 +0000 (21:15 +0800)]
multipath-tools: check null path before handle path-failed event

In the hot-plug storage OS, if we tear down the target storage,
there is a race between the path removing from the path list and
handling the path-failed udev event. Therefore, we need to check
null path before handle path-failed event.

Signed-off-by: Guan Junxiong <guanjunxiong@huawei.com>
19 months agomultipath-tools: output more topology info for NVMe discovery
Jie Yang [Mon, 4 Dec 2017 13:13:57 +0000 (21:13 +0800)]
multipath-tools: output more topology info for NVMe discovery

Assign sg_id.channel to controller id of the NVMe/NVMf target
and assign sg_id.lun to namespace ID of the target.

Signed-off-by: Jie Yang <yangjie65@huawei.com>
Reviewed-by: Guan Junxiong <guanjunxiong@huawei.com>
19 months agomultipath-tools: libdmmp: Add new error DMMP_ERR_PERMISSION_DENY
Gris Ge [Tue, 21 Nov 2017 14:09:17 +0000 (22:09 +0800)]
multipath-tools: libdmmp: Add new error DMMP_ERR_PERMISSION_DENY

 * Indicate user does not have privilege to flush mpath or invoke
   reconfig.
 * Bump API version to 0.2.0 for this API addition.

Signed-off-by: Gris Ge <fge@redhat.com>
19 months agomultipath-tools: libdmmp: Add new function dmmp_last_error_msg()
Gris Ge [Tue, 21 Nov 2017 14:09:16 +0000 (22:09 +0800)]
multipath-tools: libdmmp: Add new function dmmp_last_error_msg()

 * New function dmmp_last_error_msg() to retrieve the last error
   message.

Signed-off-by: Gris Ge <fge@redhat.com>
19 months agomultipath-tools: libdmmp: Allow log function as NULL.
Gris Ge [Tue, 21 Nov 2017 14:09:15 +0000 (22:09 +0800)]
multipath-tools: libdmmp: Allow log function as NULL.

 * Do nothing when user set log function to NULL.
 * Update document to reflect so.

Signed-off-by: Gris Ge <fge@redhat.com>
19 months agomultipathd daemon: Fix incorrect use of CLOCK_MONOTONIC in pthread
Gris Ge [Tue, 21 Nov 2017 14:09:14 +0000 (22:09 +0800)]
multipathd daemon: Fix incorrect use of CLOCK_MONOTONIC in pthread

Issue:
    When multipathd is starting up, it will reply "timeout\n" immediatly
    when got any IPC command from socket. The expected way is to wait
    uxsock_timeout/1000 seconds.

Root cause:
    pthread_mutex_timedlock() is expecting a CLOCK_REALTIME time.

Fix:
    Use CLOCK_REALTIME for pthread_mutex_timedlock().

Signed-off-by: Gris Ge <fge@redhat.com>
19 months agomultipath-tools: refresh kernel-doc from kernel sources
Xose Vazquez Perez [Fri, 17 Nov 2017 16:54:25 +0000 (17:54 +0100)]
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>
19 months agomultipath-tools: add README.alua with instructions to enable ALUA
Xose Vazquez Perez [Tue, 21 Nov 2017 18:52:13 +0000 (19:52 +0100)]
multipath-tools: add README.alua with instructions to enable ALUA

ALUA is supported in some storage devices, but usually it's disabled by default.

Cc: NetApp RDAC team <ng-eseries-upstream-maintainers@netapp.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
19 months agomultipathd/cli.h: Add a header file guard
Bart Van Assche [Tue, 12 Dec 2017 00:45:03 +0000 (16:45 -0800)]
multipathd/cli.h: Add a header file guard

This patch avoids that compilation breaks if the multipathd/cli.h
header file is included multiple times from the same compilation unit.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
19 months agoAllow the compiler to verify the consistency of the uxsock_timeout definition and...
Bart Van Assche [Tue, 12 Dec 2017 00:45:02 +0000 (16:45 -0800)]
Allow the compiler to verify the consistency of the uxsock_timeout definition and declaration

Global variables should be defined after the header file with
their declaration has been included. Hence move the declaration
of usock_timeout further down.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
19 months agoMakefile.inc: Allow additional CFLAGS to be specified on the command line
Bart Van Assche [Tue, 12 Dec 2017 00:45:01 +0000 (16:45 -0800)]
Makefile.inc: Allow additional CFLAGS to be specified on the command line

Compiling the multipath-tools source code with e.g. sparse requires
to specify additional compiler flags on the command line. Modify the
Makefile such that this becomes possible.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
21 months agomultipath-tools: replace RDAC maintainer with a generic alias
Xose Vazquez Perez [Thu, 28 Sep 2017 21:42:33 +0000 (23:42 +0200)]
multipath-tools: replace RDAC maintainer with a generic alias

Sean moved to a different role.

Cc: Sean Stewart <Sean.Stewart@netapp.com>
Cc: NetApp RDAC team <ng-eseries-upstream-maintainers@netapp.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
21 months agoBump version to 0.7.4 0.7.4
Christophe Varoqui [Wed, 15 Nov 2017 22:46:56 +0000 (23:46 +0100)]
Bump version to 0.7.4

21 months agomultipath: fix doc typo
Benjamin Marzinski [Wed, 8 Nov 2017 00:15:15 +0000 (18:15 -0600)]
multipath: fix doc typo

The dev_loss_tmo cap if fast_io_fail_tmo isn't set is 600 seconds,
not 300 seconds.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
21 months agomutipath: updated Huawei storage config
Benjamin Marzinski [Wed, 8 Nov 2017 00:15:14 +0000 (18:15 -0600)]
mutipath: updated Huawei storage config

I was given this updated built-in config by Zhou Weigang from
Huawei.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
21 months agomultipath: there is no "none" path state
Benjamin Marzinski [Wed, 8 Nov 2017 00:15:13 +0000 (18:15 -0600)]
multipath: there is no "none" path state

There is a "none" path checker, but not a "none" path state.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
21 months agomultipath: add man page info for my prkey changes
Benjamin Marzinski [Wed, 8 Nov 2017 00:15:12 +0000 (18:15 -0600)]
multipath: add man page info for my prkey changes

Update the man pages to list the new configuration options and
multipathd commands.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
21 months agompathpersist: Fix invalid condition check
Benjamin Marzinski [Wed, 8 Nov 2017 00:15:11 +0000 (18:15 -0600)]
mpathpersist: Fix invalid condition check

In commit 1990257c (mpathpersist: add support for prkeys file), the
check to see if mpathpersist needed to tell multipathd to update a
device's prkey was wrong. It had a typo that made it evaluate to true
for any service action, instead of just for registrations. This is the
correct check.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
21 months agolimbultipath: prefer RDAC checker with detect_checker
Martin Wilck [Thu, 5 Oct 2017 20:25:51 +0000 (22:25 +0200)]
limbultipath: prefer RDAC checker with detect_checker

With "detect_checker yes", ALUA is used for all storage devices
that support ALUA. But currently RDAC is still preferred for RDAC
devices
(https://www.redhat.com/archives/dm-devel/2017-September/msg00326.html)

Signed-off-by: Martin Wilck <mwilck@suse.com>
21 months agomultipath-tools: libdmmp: Fix build for members of samba domain
Michael Lass [Mon, 2 Oct 2017 18:27:32 +0000 (20:27 +0200)]
multipath-tools: libdmmp: Fix build for members of samba domain

When the user building libdmmp is part of a samba domain, mktemp will create
a path like /tmp/MYDOMAIN\mylogin/tmp.* Use quotation marks to allow using a
path containing backslashes as build otherwise fails for these users.

Signed-off-by: Michael Lass <bevan@bi-co.net>
21 months agomultipath-tools: add AccelStor/NeoSapphire to hardware table
Xose Vazquez Perez [Sat, 23 Sep 2017 23:39:03 +0000 (01:39 +0200)]
multipath-tools: add AccelStor/NeoSapphire to hardware table

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
21 months agomultipath-tools: add TMS/RamSan to hardware table
Xose Vazquez Perez [Sat, 23 Sep 2017 23:39:02 +0000 (01:39 +0200)]
multipath-tools: add TMS/RamSan to hardware table

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
21 months agomultipath-tools: delete libdmmp.pc in uninstall
Xose Vazquez Perez [Sat, 23 Sep 2017 23:39:01 +0000 (01:39 +0200)]
multipath-tools: delete libdmmp.pc in uninstall

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>
21 months agomultipath-tools: add XIV/NEXTRA to hardware table
Xose Vazquez Perez [Sat, 23 Sep 2017 23:39:00 +0000 (01:39 +0200)]
multipath-tools: add XIV/NEXTRA to hardware table

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
21 months agomultipath-tools: add XIOtech/Magnitude to hardware table
Xose Vazquez Perez [Sat, 23 Sep 2017 23:38:59 +0000 (01:38 +0200)]
multipath-tools: add XIOtech/Magnitude to hardware table

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
21 months agomultipathd: fix build without systemd
Michael Lass [Wed, 20 Sep 2017 20:47:55 +0000 (22:47 +0200)]
multipathd: fix build without systemd

do_sd_notify contains a call to sd_notify which is unknown if USE_SYSTEMD is
undefined. In this case, do_sd_notify is never called anyway, so embed the
entire function into an #ifdef USE_SYSTEMD.

This fixes a regression introduced in 88ddca5.

Signed-off-by: Michael Lass <bevan@bi-co.net>
21 months agolibmultipath: ensure checker->fd == -1 if not set
Martin Wilck [Wed, 20 Sep 2017 20:28:15 +0000 (22:28 +0200)]
libmultipath: ensure checker->fd == -1 if not set

Since 2be1fbf06c90 "libmultipath: sanitize fd handling", we treat
fd == 0 as a valid value. Make sure that this value isn't accidentally
set. Also, fix one more case where fd == 0 was considered invalid.

Fixes: 2be1fbf06c90 libmultipath: sanitize fd handling
Signed-off-by: Martin Wilck <mwilck@suse.com>