multipath-tools/.git
5 weeks agolibmultipath: don't update path queueing on reload master
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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
5 weeks 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>
3 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>
3 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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 months agomultipath-tools: calculate standard deviation on a logarithmic scale for prioritizer...
Guan Junxiong [Thu, 21 Sep 2017 13:23:19 +0000 (21:23 +0800)]
multipath-tools: calculate standard deviation on a logarithmic scale for prioritizer path_latency

There is a wrong calculation for standard deviation for prioritizers
path_latency. Because the scale is logarithmic, we need to calculate
the standard deviation on a log scale. However, if we first compute
every logarithmic value of each sample of path latency, the standard
deviation calculating is simple as before because the logarithm of
logarithmic normal distribution is normal distribution.

Besides, this patch discards the path_interval calculating because
it is unreasonable to compare two different dimension of datas.
Instead, this patch uses another condition which comparable.

In addition, the minimum base_num is large so that standard deviation
is too small to meet the new condition given that the base_num is set
to the smallest value i.e 2. This patch lets base_num range from 1.01
to 100.

Signed-off-by: Junxiong Guan <guanjunxiong@huawei.com>
3 months agomultipath-tools: use user-friendly prio_args for path-latency
Guan Junxiong [Thu, 21 Sep 2017 13:23:18 +0000 (21:23 +0800)]
multipath-tools: use user-friendly prio_args for path-latency

The original prio_args for prioritizer is like this: 20|10 which
is somewhat unconvenient for user. This patch drops it and use
a syntax that similar to other prioritizers, for example :
"base_num=5 io_num=10".

Signed-off-by: Junxiong Guan <guanjunxiong@huawei.com>
3 months agomultipath-tools: move get_next_string to util
Guan Junxiong [Thu, 21 Sep 2017 13:23:17 +0000 (21:23 +0800)]
multipath-tools: move get_next_string to util

The helper get_next_string is useful and generic. So move from
exclusive weightedpath module to util module. It will be used
in the next second patch.

Signed-off-by: Junxiong Guan <guanjunxiong@huawei.com>
3 months agomultipath-tools: use direct IO for path latency prioritizer
Guan Junxiong [Thu, 21 Sep 2017 13:23:16 +0000 (21:23 +0800)]
multipath-tools: use direct IO for path latency prioritizer

The SCSI-to-NVMe translations which was blamed broken has been removed
since linux kernel 4.13, so that SG_IO IOCTL used in the reading is not
supported. Instead, this patch drops sg_read method and uses direct IO
reading both for NVMe device and SCSI device.

Signed-off-by: Junxiong Guan <guanjunxiong@huawei.com>
3 months agomultipath-tools: discard san_path_err_XXX feature
Guan Junxiong [Tue, 24 Oct 2017 01:57:23 +0000 (09:57 +0800)]
multipath-tools: discard san_path_err_XXX feature

Even the san_path_err_threshold , san_path_err_forget_rate and
san_path_err_recovery_time is turned on, the detect sample interval of
that path checkers is so big/coarse that it doesn't see what happens
in the middle of the sample interval.

Now we have new method  of detecting path state of IO erros
especially for intermittent IO errors in the previous patch.

Therefore, discard the original commit "c3705a12b893cc302a89587c4d37".

Reviewed-by: M Muneendra Kumar <mmandala@brocade.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: M Muneendra Kumar <mmandala@brocade.com>
Signed-off-by: Junxiong Guan <guanjunxiong@huawei.com>
3 months agomultipath-tools: intermittent IO error accounting to improve reliability
Guan Junxiong [Tue, 24 Oct 2017 01:57:22 +0000 (09:57 +0800)]
multipath-tools: intermittent IO error accounting to improve reliability

This patch adds a new method of path state checking based on accounting
IO error. This is useful in many scenarios such as intermittent IO error
an a path due to network congestion, or a shaky link.

Four parameters are added for the admin:"marginal_path_double_failed_time",
marginal_path_err_sample_time", "marginal_path_err_rate_threshold" and
"marginal_path_err_recheck_gap_time". If marginal_path_err_sample_time are
set no less than 120 and marginal_path_err_recheck_gap_time are set to a
value greater than 0, when path failing events occur twice in
marginal_path_double_failed_time second due to an IO error, multipathd will
fail the path and enqueue this path into a queue of which each member is
sent a couple of continuous direct reading asynchronous IOs at a fixed
sample rate of 10HZ. The IO accounting process for a path will last for
marginal_path_err_sample_time. If the IO error rate on a particular path is
greater than the marginal_path_err_rate_threshold, then the path will not
reinstate for recover_time seconds unless there is only one active path.

If recover_time expires, we will reschedule this IO error checking process.
If the path is good enough, we will claim it good. Or else the path will
keep failed.

This helps us place the path in shaky state if we hit a lot of intermittent
IO errors on a particular path due to network/target issues and isolate such
degraded path and allow the admin to rectify the errors on a path.

Reviewed-by: Muneendra Kumar M <mmandala@Brocade.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Muneendra Kumar M <mmandala@Brocade.com>
Signed-off-by: Junxiong Guan <guanjunxiong@huawei.com>
5 months agoBump version to 0.7.3 0.7.3
Christophe Varoqui [Wed, 20 Sep 2017 17:04:24 +0000 (19:04 +0200)]
Bump version to 0.7.3

5 months agokpartx.rules: move symlink code to other files
Martin Wilck [Thu, 14 Sep 2017 20:00:10 +0000 (22:00 +0200)]
kpartx.rules: move symlink code to other files

Current kpartx.rules combines two purposes: setting properties and
creating symlinks for dm partition devices, and creating such
partition devices on top of other devices. This is contrary to
common conventions for udev rules files.

This patch moves the code for properties and symlinks into other
files. The code that generates symlinks for multipath maps is moved
to 11-dm-mpath.rules, and for partitions we introduce a new file
11-dm-parts.rules. Necessarily this results in minor code duplication.
OTOH quite some code is removed because the properties are now set
before 13-dm-disk.rules runs, so we can rely on the latter to create
the symlinks.

The reason I put this last in the series is that it will possibly
require changes in other packages, notably dracut, in order to make
sure partitions mappings are cleanly set up during boot.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agokpartx/del-part-nodes.rules: new udev file
Martin Wilck [Thu, 14 Sep 2017 20:00:09 +0000 (22:00 +0200)]
kpartx/del-part-nodes.rules: new udev file

A new udev rules file "68-del-part-nodes.rules" is introduced,
based on code from Ben Marzinki. This code deletes partitions on
multipath member devices. The purpose of this is to avoid users
accidentally accessing partitions of member devices rather than of the
multipath devcice. The deletion is done only once for every disk
device. If the user wants to get the partitions back, he can run "partx
-a" or "partprobe" on the disk device.

This code could be extended to wipe partitions on member devices
of non-multipath dm targets if desired.

Means to deactivate this behavior are provided via kernel parameter
"dont_del_part_nodes", or a custom udev rules file setting the
"DONT_DEL_PART_NODES" environment variable.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agomultipath/kpartx rules: avoid superfluous scanning
Martin Wilck [Sat, 2 Sep 2017 22:38:58 +0000 (00:38 +0200)]
multipath/kpartx rules: avoid superfluous scanning

Multipath maps receive certain udev events that only indicate
changes in the path list. Use MPATH_UNCHANGED to tell this to
upper layers, so that they can ignore the event.

multipathd-generated events with DM_SUBSYSTEM_UDEV_FLAG0 are one
case, and kernel-generated PATH_FAILED and PATH_REINSTATED events
are another.

The LVM rules rely on DM_ACTIVATION, but other rules such as
kpartx can't do that, because they'd miss e.g. partition table
changes.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agokpartx.rules: fix logic for adding partitions
Martin Wilck [Sat, 2 Sep 2017 22:38:57 +0000 (00:38 +0200)]
kpartx.rules: fix logic for adding partitions

Based on code by Ben Marzinski, this patch updates kpartx.rules.

The main change is that the flags that determine whether scanning is now
possible are DM_NOSCAN and DM_SUSPENDED. This assumes that said flags
are set correctly by 11-dm-mpath.rules.

Note that kpartx can't just be run if DM_ACTIVATION=1; doing so we
would miss events caused e.g. by partition table editing. It's not
necessary to scan for certain events. This will be handled in another
patch.

Currently this works for multipath only, but code for other targets
could be added if desired.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agokpartx.rules: generate type-name links only for multipath devices
Martin Wilck [Sat, 2 Sep 2017 22:38:56 +0000 (00:38 +0200)]
kpartx.rules: generate type-name links only for multipath devices

... and their partitions. This rule generates irritiating symlinks
like /dev/disk/by-id/raid-${VG}-${LV} for LVM LVs otherwise.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agokpartx.rules: create by-partuuid and by-partlabel symlinks
Martin Wilck [Sat, 2 Sep 2017 22:38:55 +0000 (00:38 +0200)]
kpartx.rules: create by-partuuid and by-partlabel symlinks

The LVM rules do this since 2.02.173 (c48149cf80 "udev: also
create /dev/disk/by-part{label,uuid} and gpt-auto-root symlinks").
We have to do it here for partitions on unaccessible mpath maps.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agokpartx.rules: improved logic for by-uuid and by-label links
Martin Wilck [Sat, 2 Sep 2017 22:38:54 +0000 (00:38 +0200)]
kpartx.rules: improved logic for by-uuid and by-label links

If blkid can be run, these links are already set up by 13-dm-disk.rules.
In the DM_NOSCAN=1 case, they are imported from db in 11-dm-mpath.rules
for multipath maps, but not for partitions (there is currently no flag
for kpartx-generated partitions that indicates whether the device will
be able to do IO).

Moreover, the previous logic for running IMPORT{db} was wrong (condition
used '=="?*"' rather than '!="?*"').

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agokpartx.rules: respect DM_UDEV_LOW_PRIORITY_FLAG
Martin Wilck [Sat, 2 Sep 2017 22:38:53 +0000 (00:38 +0200)]
kpartx.rules: respect DM_UDEV_LOW_PRIORITY_FLAG

kpartx.rules increased link priority unconditionally, but for
explicitly marked low prio devices that shouldn't be done.
Fix that. Also, use "+=" for OPTIONS, as most other rules do.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agokpartx.rules: don't rely on DM_DEPS and DM_TABLE_STATE
Martin Wilck [Sat, 2 Sep 2017 22:38:52 +0000 (00:38 +0200)]
kpartx.rules: don't rely on DM_DEPS and DM_TABLE_STATE

These tests (which were SUSE-specific anyway) are not needed
here. The kpartx invocation further down is guarded separately.
SYMLINK actions must be run in any case for consistency, and
there's no need to access the udev db here because kpartx_id
also works on otherwise broken devices.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agomultipath.rules: set ID_FS_TYPE to "mpath_member"
Martin Wilck [Sat, 2 Sep 2017 22:38:51 +0000 (00:38 +0200)]
multipath.rules: set ID_FS_TYPE to "mpath_member"

... for devices that have been identified as such.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months ago11-dm-mpath.rules: handle new maps with READY==0
Martin Wilck [Sat, 2 Sep 2017 22:38:48 +0000 (00:38 +0200)]
11-dm-mpath.rules: handle new maps with READY==0

We need to distinguish the case where a device came up with
ENV{MPATH_DEVICE_READY}=="0" in the first place from the case
where it changed from "ready" to "not ready".

Otherwise, we may save a wrong state in DM_DISABLE_OTHER_RULES_FLAG_OLD.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months ago11-dm-mpath.rules: no need to test before IMPORT
Martin Wilck [Sat, 2 Sep 2017 22:38:47 +0000 (00:38 +0200)]
11-dm-mpath.rules: no need to test before IMPORT

This code is run before 13-dm-disk.rules which calls "blkid",
therefore the code can be simplified because the condition checked
always holds.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months ago11-dm-mpath.rules: import more ID_FS_xxx vars from db
Martin Wilck [Sat, 2 Sep 2017 22:38:46 +0000 (00:38 +0200)]
11-dm-mpath.rules: import more ID_FS_xxx vars from db

We have code for importing blkid variables from db but this code
is missing the _ENC variants needed for creating symlinks, and
ID_FS_LABEL.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months ago11-dm-mpath.rules: multipath -U for READY check
Martin Wilck [Sat, 2 Sep 2017 22:38:45 +0000 (00:38 +0200)]
11-dm-mpath.rules: multipath -U for READY check

For kernel-generated path events, DM_NR_VALID_PATHS indicates
whether usable paths are available. But this information isn't
reliable as events may be received out of order.

Use multipath -U to determine whether a multipath map can
handle I/O.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agomultipath: implement "check usable paths" (-C/-U)
Martin Wilck [Sat, 2 Sep 2017 22:38:44 +0000 (00:38 +0200)]
multipath: implement "check usable paths" (-C/-U)

When we process udev rules, it's crucial to know whether I/O on a given
device will succeed. Unfortunately DM_NR_VALID_PATHS is not reliable,
because the kernel path events aren't necessarily received in order, and
even if they are, the number of usable paths may have changed during
udev processing, in particular when there's a lot of load on udev
because many paths are failing or reinstating at the same time.
The latter problem can't be completely avoided, but the closer the
test before the actual "blkid" call, the better.

This patch adds the -C/-U options to multipath to check if a given
map has usable paths. Obviously this command must avoid doing any I/O
on the multipath map itself, thus no checkers are called; only status
from sysfs and dm is collected.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: add dm_get_multipath
Martin Wilck [Sat, 2 Sep 2017 22:38:43 +0000 (00:38 +0200)]
libmultipath: add dm_get_multipath

This function is simply factored out from dm_get_maps.
No functional difference.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: add DI_NOIO flag for pathinfo
Martin Wilck [Sat, 2 Sep 2017 22:38:42 +0000 (00:38 +0200)]
libmultipath: add DI_NOIO flag for pathinfo

This flag can used to avoid any IO on the device itself. Useful
for getting the path state without the risk of hanging or running
into IO errors.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: use const char* in some dm helpers
Martin Wilck [Sat, 2 Sep 2017 22:38:41 +0000 (00:38 +0200)]
libmultipath: use const char* in some dm helpers

Changing dm_get_info and dm_get_uuid for now.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: get_refwwid: use get_udev_device
Martin Wilck [Sat, 2 Sep 2017 22:38:40 +0000 (00:38 +0200)]
libmultipath: get_refwwid: use get_udev_device

Call the factored-out function to obtain the udev device.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: add get_udev_device
Martin Wilck [Sat, 2 Sep 2017 22:38:39 +0000 (00:38 +0200)]
libmultipath: add get_udev_device

This factors out the functionality of retrieving the
udev_device from different device types from get_refwwid.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: support MPATH_UDEV_NO_PATHS_FLAG on map creation
Martin Wilck [Sat, 2 Sep 2017 22:38:38 +0000 (00:38 +0200)]
libmultipath: support MPATH_UDEV_NO_PATHS_FLAG on map creation

Some vendor kernels (e.g. SUSE) have supported loading multipath
maps without valid paths for a long time. Without that feature,
problems can occur in failover scenarios when multipathd tries
to (re)load maps after device failure/removal, because multipathd's
attempts to reload the configuration may fail unnecessarily.
The discussion in the kernel community is ongoing
(see e.g. https://patchwork.kernel.org/patch/4579551/).

One corner case of this is creation of a map with only failed
paths. Such maps can be created if the kernel patch mentioned above
is applied. The current udev rules for dm-multipath can't detect
this situation. This patch fixes that by setting
DM_SUBSYSTEM_UDEV_FLAG2, which is already used for the "map reload"
case with no valid paths. Thus no additional udev rules are required
to detect this situation.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agokpartx: only recognize dasd part table on DASD
Martin Wilck [Sat, 2 Sep 2017 22:38:37 +0000 (00:38 +0200)]
kpartx: only recognize dasd part table on DASD

The code for reading DASD partition tables is so generic
that it will pretend to find a partition even on a totally
zeroed disk. Prevent that by recognizing dasd partition tables
only on DASD disks. Such a check was already present for DM
mappings on DASD, but (strangely) not for DASD itself.

Without this, kpartx will (try to) create a partition mapping
on a loop device with no partition table.

Found this during testing because test-kpartx unexpectedly
succeeded without my "fix part deletion without partition table" fix
when run on a loop device. That was caused by this bug pretending an
existing partition table although there was none.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agotest-kpartx: test deletion with empty part table
Martin Wilck [Sat, 2 Sep 2017 22:38:36 +0000 (00:38 +0200)]
test-kpartx: test deletion with empty part table

Added a test case for "kpartx: fix part deletion without partition
table".

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agokpartx: fix part deletion without partition table
Martin Wilck [Sat, 2 Sep 2017 22:38:35 +0000 (00:38 +0200)]
kpartx: fix part deletion without partition table

If we are deleting partition mappings, there's no need to
parse the partition table. We just look for mappings created
by kpartx and destroy them. Without this patch, kpartx fails
to delete partition mappings on devices on which the partition
table has been destroyed.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agokpartx: fix a corner case when renaming partitions
Martin Wilck [Sat, 2 Sep 2017 22:38:34 +0000 (00:38 +0200)]
kpartx: fix a corner case when renaming partitions

Fix a pathological issue that I discovered with test-kpartx.
When a dm device is named like a device node (e.g. dm name "loop1"),
kpartx would erroneously pick the dm device if asked to work on
partitions on the other device. Fortunately we can use the UUID
scheme created earlier to see whether or not the device is a dm device.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agotest-kpartx: add tests for renaming functionality
Martin Wilck [Sat, 2 Sep 2017 22:38:33 +0000 (00:38 +0200)]
test-kpartx: add tests for renaming functionality

Add test for the functionality implemented in patch
"kpartx: search partitions by UUID, and rename".

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agokpartx: search partitions by UUID, and rename
Martin Wilck [Sat, 2 Sep 2017 22:38:32 +0000 (00:38 +0200)]
kpartx: search partitions by UUID, and rename

Partition mappings may have been created by other tools such as parted,
multipathd (during map renaming), or kpartx itself with different
delimiter (-p) option. In such cases kpartx fails, because the partition
mappings have a different name. However, we have a convention for UUID
mappings which seems to be more universal. So, when the search for the
named partition fails, search for the UUID instead and try to rename the
map.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agokpartx: helper functions for name and uuid generation
Martin Wilck [Sat, 2 Sep 2017 22:38:31 +0000 (00:38 +0200)]
kpartx: helper functions for name and uuid generation

strip_slash() is copied from kpartx.c, and will be removed there
in a follow-up patch. The others are new helpers.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: fix partition_delimiter config option
Martin Wilck [Sat, 2 Sep 2017 22:38:30 +0000 (00:38 +0200)]
libmultipath: fix partition_delimiter config option

The partition_delimiter setting was effecitvely ignored. Fix it.

Fixes: 95bf339bb9d7 "correctly set partition delimiter on rename"
Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agohwtable: set 'none' as default checker for NVMe
Hannes Reinecke [Fri, 15 Sep 2017 06:30:30 +0000 (08:30 +0200)]
hwtable: set 'none' as default checker for NVMe

We shouldn't be using the directio checker for NVMe, as this might
cause spurious path failures under high load.
As the 'state' attribute provides reliable information about the link
status it's sufficient to just check this and don't call any
path checkers.

Signed-off-by: Hannes Reinecke <hare@suse.com>
5 months agoAdd 'none' checker
Hannes Reinecke [Fri, 15 Sep 2017 06:30:29 +0000 (08:30 +0200)]
Add 'none' checker

For NVMe we don't have a good way of checking the path state, so
add a new checker 'none' which doesn't do any checking, but rely
on the internal sysfs state for path checking.

Signed-off-by: Hannes Reinecke <hare@suse.com>
5 months agolibmultipath/discovery: modify NVMe path states
Hannes Reinecke [Fri, 15 Sep 2017 06:30:28 +0000 (08:30 +0200)]
libmultipath/discovery: modify NVMe path states

The NVMe path states 'resetting' and 'reconnecting' indicate that
the controller could not talk to the namespace, which translates
into a path down state, not a path pending state.
Path pending should only be used for short lived intermediate states
like 'new' or 'deleting'.

Signed-off-by: Hannes Reinecke <hare@suse.com>
5 months agodiscovery: sanitize NVMe discovery
Hannes Reinecke [Fri, 15 Sep 2017 06:30:27 +0000 (08:30 +0200)]
discovery: sanitize NVMe discovery

Bring the output of NVMe discovery inline with the other transports,
and set the sg_id mappings to avoid ugly '#' outputs.

Signed-off-by: Hannes Reinecke <hare@suse.com>
5 months agomultipath-tools: libdmmp: New function to flush and reconfig
Gris Ge [Wed, 16 Aug 2017 12:34:09 +0000 (20:34 +0800)]
multipath-tools: libdmmp: New function to flush and reconfig

New functions:
    * dmmp_reconfig() to invoke reconfiguration of multipathd daemon.
    * dmmp_flush_mpath() to flush/del unused mpath.

Signed-off-by: Gris Ge <fge@redhat.com>
5 months agomultipath-tools: libdmmp: Improve timeout mechanism
Gris Ge [Wed, 16 Aug 2017 12:34:08 +0000 (20:34 +0800)]
multipath-tools: libdmmp: Improve timeout mechanism

Issue:
    libdmmp return error of timeout before user requested timeout was
    met.
    This happens when multipathd daemon is starting with a lot(1k+) mpaths.

Root cause:
    The multipath has two timeout settings:
        1. 'uxsock_timeout' in multipath.conf
        2. libmpathcmd timeout argument.
    And the first is not controllable in current libdmmp code.

Fix:
    * Only keep 1 timeout setting in libdmmp:
        dmmp_context_timeout_set()/dmmp_context_timeout_get().
    * libdmmp will keep reply until meet user requested timeout.
    * Allow user to set timeout as 0 which mean infinite, only return
      when error or pass.
    * Updated libdmmp.h document to to indicate timeout 0 as infinite.
    * Increase timeout setting in libdmmp test case to test this
      mechanism.

Signed-off-by: Gris Ge <fge@redhat.com>
5 months agomultipath-tools: Remove the limitation of IPC command reply length.
Gris Ge [Wed, 16 Aug 2017 12:34:07 +0000 (20:34 +0800)]
multipath-tools: Remove the limitation of IPC command reply length.

Issue:
    libmpathcmd will reply error 22(Invalid argument) when having 1000
    mpath.

Root cause:
    libmpathcmd return error when reply string length exceeded the 65535.

Fix:
    Remove the limitation on reply data length.

Extra:
    Initially this limitation was removed and improved by commit
    bb219efb131aef61c331f181193bf1d80e6b2a99
    but then was added back via commit
    7381c3f2b19903cc56d1ddafb13e8ad3afc08580

Signed-off-by: Gris Ge <fge@redhat.com>
5 months agomultipath-tools: add info about adding new hardware
Xose Vazquez Perez [Tue, 12 Sep 2017 16:24:01 +0000 (18:24 +0200)]
multipath-tools: add info about adding new hardware

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>
5 months agolibmultipath: update INFINIDAT builtin config
Arnon Yaari [Tue, 29 Aug 2017 11:27:22 +0000 (14:27 +0300)]
libmultipath: update INFINIDAT builtin config

Based on the manufacturer documentation:
https://support.infinidat.com/hc/en-us/articles/202319222

INFINIDAT recommends round-robin path selector using
a different path per IO. Timeout and path recovery values
are adjusted for error-free hot upgrade scenarios.

Signed-off-by: Arnon Yaari <arnony@infinidat.com>
5 months agomultipath-tools: add Dot Hill/Seagate arrays to hwtable
Xose Vazquez Perez [Sat, 12 Aug 2017 16:30:36 +0000 (18:30 +0200)]
multipath-tools: add Dot Hill/Seagate arrays to hwtable

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
5 months agomultipath-tools: add Xiotech iglu blaze arrays to hwtable
Xose Vazquez Perez [Thu, 10 Aug 2017 19:18:24 +0000 (21:18 +0200)]
multipath-tools: add Xiotech iglu blaze arrays to hwtable

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
5 months agomultipath-tools: add support for all arrays from Sun StorEdge 3000 family
Xose Vazquez Perez [Thu, 10 Aug 2017 19:18:09 +0000 (21:18 +0200)]
multipath-tools: add support for all arrays from Sun StorEdge 3000 family

They were made by Dot Hill.

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>
5 months agomultipath-tools: remove Sun StorEdge T4(6020,6120,6320) arrays from hwtable
Xose Vazquez Perez [Wed, 9 Aug 2017 17:00:56 +0000 (19:00 +0200)]
multipath-tools: remove Sun StorEdge T4(6020,6120,6320) arrays from hwtable

Multipathing for these arrays is not supported by multipath-tools.
Only available with Sun StorEdge Traffic Manager software.
Or with a "new" infrastructure: https://marc.info/?l=dm-devel&m=116322662722330

Cc: James Cassidy <jcassidy@qfire.net>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
5 months agomultipath-tools: link internal libraries before foreigns
Martin Wilck [Mon, 14 Aug 2017 20:40:43 +0000 (22:40 +0200)]
multipath-tools: link internal libraries before foreigns

Otherwise, the runtime linker may resolve foreign symbols instead of
internal ones for certain symbol names (observed with xfree()
from libreadline).

Reported-by: nikola.pajkovsky@suse.com
Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: cli_add_map: Use CMD_NONE
Martin Wilck [Mon, 14 Aug 2017 20:40:42 +0000 (22:40 +0200)]
libmultipath: cli_add_map: Use CMD_NONE

Commands issued from the daemon itself should always pass
CMD_NONE to coalesce_paths. Otherwise, the daemon mistakenly
tries to talk to itself via the socket, causing deadlock.

Reproduce simply by calling "multipathd add map $X".

Fixes: d19936f4 "libmultipath: Do not access 'conf->cmd' in domap()"
Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agokpartx/devmapper.h: remove dm_no_partitions
Martin Wilck [Mon, 14 Aug 2017 20:40:41 +0000 (22:40 +0200)]
kpartx/devmapper.h: remove dm_no_partitions

This removes the deleted function from the header file.

Fixes: 2ea69fc9 'kpartx: remove "no_partitions" support'
Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: sanitize fd handling
Hannes Reinecke [Fri, 15 Sep 2017 06:15:12 +0000 (08:15 +0200)]
libmultipath: sanitize fd handling

One should remember that '0' _is_ a valid fd, so we need to set
the fd to '-1' upon allocating the path structure and ensure we're
checking for a value _smaller_ than 0 to detect an invalid fd.

Signed-off-by: Hannes Reinecke <hare@suse.com>
5 months agomultipath-tools: replace "setting: array" with "setting: storage device" at multipath...
Xose Vazquez Perez [Sun, 20 Aug 2017 00:47:13 +0000 (02:47 +0200)]
multipath-tools: replace "setting: array" with "setting: storage device" at multipath output

Reported-by: Martin Wilck <mwilck@suse.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
5 months agomultipath-tools: clarify how to dump the multipathd config
Xose Vazquez Perez [Mon, 28 Aug 2017 23:46:59 +0000 (01:46 +0200)]
multipath-tools: clarify how to dump the multipathd config

Reported-by: Martin Wilck <mwilck@suse.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
5 months agolibmultipath: add_feature: allow only 1 feature
Martin Wilck [Mon, 28 Aug 2017 22:05:35 +0000 (00:05 +0200)]
libmultipath: add_feature: allow only 1 feature

The existing test "if feature is already present" doesn't work for
multiple features, and we are only using add_feature() for single
feature additions anyway. Simplify the code by not allowing spaces
in the feature string to be added. This way we can drop the
complex "count new features" code. Moreover, print an error message if
the existing features string is malformed.

The old code calculated the width of the feature count twice, and the
second time messed up the buffer length field passed to snprintf(); fix
that, too.  Finally, replace several strcat() invocations by one
strncpy() call to make the code easier to review.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: add_feature: skip pointless NULL check
Martin Wilck [Mon, 28 Aug 2017 22:05:34 +0000 (00:05 +0200)]
libmultipath: add_feature: skip pointless NULL check

The case f == NULL is already handled by the code from
b1ecdd46b6ec "segment faulty occured in add_feature()" above.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agomultipathd: don't flood system with sd_notify calls
Martin Wilck [Mon, 28 Aug 2017 22:05:33 +0000 (00:05 +0200)]
multipathd: don't flood system with sd_notify calls

DAEMON_RUNNING is only used by checkerloop to indicate that
path checkers are running. checkerloop switches back and forth
between DAEMON_IDLE and DAEMON_RUNNING in every iteration, i.e.
it performs two status changes per second on an idle system.
The repeated sd_notify() calls cause a lot of traffic on dbus as
systemd forwards these messages on the system bus. This can be
seen with systemd.log_level=debug. Better skip these notifications
that don't provide useful information to the user, who is very
unlikely to catch the daemon in "running" state anyway.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agomultipath-tools: fix incorrect length for strncmp in uevent.c
Guan Junxiong [Tue, 5 Sep 2017 03:54:42 +0000 (11:54 +0800)]
multipath-tools: fix incorrect length for strncmp in uevent.c

Cc: Martin Wilck <mwilck@suse.com>
Signed-off-by: Junxiong Guan <guanjunxiong@huawei.com>
5 months agomultipath-tools: minor edition and corrections in multipath.conf.5
Xose Vazquez Perez [Thu, 17 Aug 2017 22:42:14 +0000 (00:42 +0200)]
multipath-tools: minor edition and corrections in multipath.conf.5

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>