multipath-tools/.git
3 weeks agomultipath-tools: replace RDAC maintainer with a generic alias master
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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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>
2 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

2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 months agompathpersist: add support for prkeys file
Benjamin Marzinski [Fri, 15 Sep 2017 22:25:36 +0000 (17:25 -0500)]
mpathpersist: add support for prkeys file

When the reservation_key is set to "file", the reservation key needs to
be added to the prkeys file for multipathd to be able to register new
paths as they are added to the device.  This patch adds support to the
mpathpersist command to message multipathd when a key is registered or
unregistered to either add or remove the mapping from the prkeys file.

With these changes, once a device is configured to use the prkeys file,
running mpathpersist commands will automatically update the prkeys file
as necessary.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 months agomultipath: add alternate reservation_key method
Benjamin Marzinski [Fri, 15 Sep 2017 22:25:35 +0000 (17:25 -0500)]
multipath: add alternate reservation_key method

The scsi persistent reservation API doesn't force devices to implement
any method to display the mapping from a reservation key to an I_T Nexus
(the READ_FULL_STATUS action is an optional later addition, and a number
of devices don't support it). To allow multipathd to determine the
correct reservation key for a device without support from the device
itself, it uses the reservation_key configuration option. Unfortunately,
using this option forces the multipath configuration to be updated
whenever a new scsi registration key is used.  This isn't acceptable to
some users, who want a static configuration file.

This patch provides an alternate method of setting the reservation_key
for the multipath device. The reservation_key configuration option now
also accepts the keyword "file". If this is used, multpath will look in
the new prkeys file (by default "/etc/multipath/prkeys") for a line with
the device wwid and it's associated reservation_key. Where a device's
reservation key comes from is tracked by the prkey_source variable,
which is set and read through the reservation_key dict.c functions.

There are also new multipathd commands to get, set, and unset the
mappings in the prkesy file. Currently,

"multipathd map $map setprkey key $key" sets the mapping
"multipathd map $map unsetprkey" unsets the mapping
"multipathd map $map getprkey" gets the current reservation_key for a
multipath device.

There is some lack of symmetry here where you are allowed to set and
unset mappings even for devices that aren't configured to use the prkeys
file, but you will only get the mapping from the prkeys file for devices
that are configured to use it. Otherwise you will get the mapping from
multipath.conf. In other words, setprkey and unsetprkey return success
but don't do anything useful unless a device is configured with

reservation_key file

but getprkey will return the device's current reservation_key regardless
of where the key came from.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 months agolibmpathpersist: fix update_prflag code
Benjamin Marzinski [Fri, 15 Sep 2017 22:25:34 +0000 (17:25 -0500)]
libmpathpersist: fix update_prflag code

There are multiple problems with the prflag code. First, it doesn't do
anything useful at all currently. update_prflags is called with "set"
and "unset" instead of "setprstatus" and "unsetprstatus", so it doesn't
actually enable persistent reservation tracking in multipathd when a key
is registered. Second, the string is to store the multipathd message is
64 bytes long, while just a WWID, which can be used as an alias, can be
128 bytes long, so it's possible to run out of space in the message.
Finally, it is called by mpath_persistent_reserve_out when doing a
preempt and abort, which doesn't make any sense. This disables
multipathd persistent reservation tracking when a node has just taken
over the reservation on a device.

This patch fixes these issues, cleans up the return codes and variable
names, and splits update_prflag into two functions, so that the bulk of
the work (now in do_update_pr), can be reused by other callers.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 months agolibmultipath: change reservation_key to a be64
Benjamin Marzinski [Fri, 15 Sep 2017 22:25:32 +0000 (17:25 -0500)]
libmultipath: change reservation_key to a be64

The reservation key is currently being stored as any array of 8 unsigned
chars.  This is exactly the same in-memory representation as a big
endian 64 bit integer. However, the code for dealing with a big endian
64 bit integer is much simpler, so switch to use that instead.  Instead
of directly using a uint64_t, which could cause problems if people
forgot the conversion from cpu order to big endian, Martin suggested
using a structure and some helper macros to store it.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 months agolibmultipath: pull functions into util.c
Benjamin Marzinski [Fri, 15 Sep 2017 22:25:31 +0000 (17:25 -0500)]
libmultipath: pull functions into util.c

This patch just pulls safe_write out of rbd. and the persistent
reservation key parsing code out of dict.c and puts them in util.c,
so that other functions can make use of them.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 months agolibmultipath: add pthread_cleanup hook for udev monitor
Hannes Reinecke [Fri, 15 Sep 2017 06:14:30 +0000 (08:14 +0200)]
libmultipath: add pthread_cleanup hook for udev monitor

The udev monitor from uevent_listen() needs to be cleaned up from
a pthread cleanup hook.
Valgrind complained here.

Signed-off-by: Hannes Reinecke <hare@suse.com>
4 months agoBump version to 0.7.2 0.7.2
Christophe Varoqui [Sat, 5 Aug 2017 06:35:36 +0000 (08:35 +0200)]
Bump version to 0.7.2

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

This updated config comes from hp.

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

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

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
4 months agomultipath-tools: beautify path_latency.c code
Xose Vazquez Perez [Thu, 22 Jun 2017 16:46:23 +0000 (18:46 +0200)]
multipath-tools: beautify path_latency.c code

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

Cc: Yang Feng <philip.yang@huawei.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
4 months agomultipath-tools: sync third-party headers with 3.13 upstream
Xose Vazquez Perez [Wed, 21 Jun 2017 12:26:39 +0000 (14:26 +0200)]
multipath-tools: sync third-party headers with 3.13 upstream

Cc: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
4 months agomultipath-tools: check sysfs path state for NVMe/NVMf
Guan Junxiong [Fri, 28 Jul 2017 01:28:43 +0000 (09:28 +0800)]
multipath-tools: check sysfs path state for NVMe/NVMf

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

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

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

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
4 months agolibmultipath: fix over-long NVME WWIDs
Martin Wilck [Tue, 18 Jul 2017 07:29:16 +0000 (09:29 +0200)]
libmultipath: fix over-long NVME WWIDs

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Martin Wilck <mwilck@suse.com>
Acked-by: Benjamin Marzinski <bmarzins@redhat.com>
4 months agomultipath-tools: add HPE MSA 2050/2052 to hwtable
Xose Vazquez Perez [Sat, 8 Jul 2017 11:45:19 +0000 (13:45 +0200)]
multipath-tools: add HPE MSA 2050/2052 to hwtable

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
4 months agomultipath-tools: add HPE StoreVirtual 3200 family to hwtable
Xose Vazquez Perez [Fri, 7 Jul 2017 13:55:45 +0000 (15:55 +0200)]
multipath-tools: add HPE StoreVirtual 3200 family to hwtable

It's a new LEFTHAND array.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
4 months agolibmultipath: fix unit to seconds in log message for checker timeout
Martin Wilck [Tue, 27 Jun 2017 15:11:47 +0000 (17:11 +0200)]
libmultipath: fix unit to seconds in log message for checker timeout

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

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

CC: Gris Ge <fge@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
4 months agokpartx.rules: Fix syntax error in skip_kpartx code
Martin Wilck [Fri, 23 Jun 2017 21:57:40 +0000 (23:57 +0200)]
kpartx.rules: Fix syntax error in skip_kpartx code

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

and the 'MD Series' comment to the right place.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
4 months agolibmultipath: retain_attached_hw_handler obsolete with 4.3+
Martin Wilck [Thu, 22 Jun 2017 14:59:11 +0000 (16:59 +0200)]
libmultipath: retain_attached_hw_handler obsolete with 4.3+

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

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

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>