multipath-tools/.git
5 months agoRevert "Set priority to '0' for PATH_BLOCKED or PATH_DOWN"
Martin Wilck [Thu, 11 Apr 2019 10:49:21 +0000 (12:49 +0200)]
Revert "Set priority to '0' for PATH_BLOCKED or PATH_DOWN"

This reverts commit ce8d707c4235860373238dea6491a77a931d4c9f.

In check_path(), we don't touch path priority if a path is down.
But when pathinfo(DI_CHECKER) is called in down state, we reset
the priority to 0. This is inconsistent.

Commit ce8d707 was about maps being rejected during multipath startup
because of undefined priorities. Since commit 94036e3 "libmultipath:
don't reject maps with undefined prio", such maps aren't rejected
any more, thus we can skip resetting the priority to 0.

Note that when we calculate path group priorities, the prio of
paths which are not UP or GHOST are ignored anyway, so this
change will not cause changes wrt PG priorities or PG ordering.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Cc: Hannes Reinecke <hare@suse.de>
5 months agolibmultipath: group_by_prio: fix signedness bug
Martin Wilck [Thu, 11 Apr 2019 10:49:20 +0000 (12:49 +0200)]
libmultipath: group_by_prio: fix signedness bug

pp->priority can be negative, so we we shouldn't compare
it with an unsigned int.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agomultipath: check on multipathd without starting it
Benjamin Marzinski [Thu, 18 Apr 2019 17:49:46 +0000 (12:49 -0500)]
multipath: check on multipathd without starting it

When "multipath -u" is run, it checks if multipathd is running.
Currently it does this by trying to connect to the mutipathd socket.
This can cause problems during boot.  The multipathd.socket systemd unit
file will cause "multipath -u" to wait until multipathd has been started
before continuing.  If there is a lot of activity on the system,
multipathd may not start up immediately, causing block device
initialization to be delayed, potentially until after systemd times
waiting for the device.  To avoid this, multipath now checks if
multipathd is running by reading /run/multipathd.pid and checking the
/proc/<pid>/comm to verify that multipathd is really running with this
pid. This avoids forcing "multipath -u" to wait on multipathd starting
up.

As an alternative to this patch, multipath could simply switch the order
of the calls to systemd_service_enabled() and mpath_connect(). This would
make multipath only try to connect with multipathd if it wasn't enabled in
systemd, so that it wouldn't autostart.

Another alternative is to do away with multipathd.socket. Since multipathd
needs to always be running in order to get uevents, there isn't much value
in having it autoactivate when it gets an interactive command.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agoBump version to 0.8.1 0.8.1
Christophe Varoqui [Thu, 18 Apr 2019 11:13:10 +0000 (13:13 +0200)]
Bump version to 0.8.1

5 months agomultipath-tools: reorder vendors in hwtable
Xose Vazquez Perez [Sat, 16 Mar 2019 23:05:06 +0000 (00:05 +0100)]
multipath-tools: reorder vendors in hwtable

Xio was acquired by Violin, and add FlashSystem 9100 to Storwize in comments.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
5 months agomultipath-tools: maintain the uniformity in the multipath.conf.5 page
Xose Vazquez Perez [Sat, 16 Mar 2019 22:25:56 +0000 (23:25 +0100)]
multipath-tools: maintain the uniformity in the multipath.conf.5 page

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
5 months agolibmultipath: hwtable: add Lenovo DE series
Martin Wilck [Mon, 18 Mar 2019 11:24:45 +0000 (12:24 +0100)]
libmultipath: hwtable: add Lenovo DE series

I got this from Steven.

Cc: Steve.Schremmer@netapp.com
Cc: NetApp RDAC team <ng-eseries-upstream-maintainers@netapp.com>
Cc: xose.vazquez@gmail.com
Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: check_rdac(): pre-check in hwtable
Martin Wilck [Mon, 18 Mar 2019 11:24:44 +0000 (12:24 +0100)]
libmultipath: check_rdac(): pre-check in hwtable

Currently check_rdac() always runs an SG_IO for VPD 0xc9 to check
if the storage supports RDAC. This is an extra IO, and may cause
annoying error messages on the storage side for non-RDAC arrays.
Do not use the RDAC override for arrays that have legacy configuration
to use a checker other than "rdac". For "unkown" devices with no checker
configured in either the hwtable or multipath.conf, the VPD call will
be tried.

Cc: Steve.Schremmer@netapp.com
Cc: NetApp RDAC team <ng-eseries-upstream-maintainers@netapp.com>
Cc: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: tidy up do_set_from_hwe() with statement expression
Martin Wilck [Mon, 18 Mar 2019 11:24:43 +0000 (12:24 +0100)]
libmultipath: tidy up do_set_from_hwe() with statement expression

propsel.c has a lot of "funky" macros making assumptions about
variable and label names in callers. This one is particularly
ugly. As a first tidy-up step, split out a statement expression
which can be called cleanly from code that doesn't have said
variables and labels.

Cc: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: don't link alua_rtpg.o twice
Martin Wilck [Mon, 18 Mar 2019 11:24:42 +0000 (12:24 +0100)]
libmultipath: don't link alua_rtpg.o twice

We link this already to libmultipath.so. Therefore, no need
to link ti to libprioalua.so, too.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: lazy tpgs probing
Martin Wilck [Mon, 18 Mar 2019 11:24:41 +0000 (12:24 +0100)]
libmultipath: lazy tpgs probing

Provide a "getter" function that can be used to probe tpgs lazily.
This way we don't need to send an RTPG in the pathinfo() call
chain (e.g. in "multipath -u"). With this in place, no "user"
code should access pp->tpgs directly any more.

Moreover, in select_prio(), in the case where the alua checker
was statically configured, rather then calling into the alua
code directly, use get_tpgs(), which does all the proper error
checking, and fall back to const prio if it fails.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: detect_alua(): use system timeout
Martin Wilck [Mon, 18 Mar 2019 11:24:40 +0000 (12:24 +0100)]
libmultipath: detect_alua(): use system timeout

This is not the path checker - we don't need to use the
configured checker timeout here. This makes it possible to
call this function without a current (struct config *).

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: constify sysfs_get_timeout()
Martin Wilck [Mon, 18 Mar 2019 11:24:39 +0000 (12:24 +0100)]
libmultipath: constify sysfs_get_timeout()

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: alua: try to retrieve inquiry data from sysfs
Martin Wilck [Mon, 18 Mar 2019 11:24:38 +0000 (12:24 +0100)]
libmultipath: alua: try to retrieve inquiry data from sysfs

This can avoid IO while configuring the path prioritizer.
The alua prioritizer avoids reading from sysfs for a reason
(see commit 7e2f46d3), but this applies only to RTPG / STPG,
not to INQUIRY calls.

Cc: Steve.Schremmer@netapp.com
Cc: NetApp RDAC team <ng-eseries-upstream-maintainers@netapp.com>
Cc: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: alua: make API more consistent
Martin Wilck [Mon, 18 Mar 2019 11:24:37 +0000 (12:24 +0100)]
libmultipath: alua: make API more consistent

Let all alua functions take "const struct path *" as first
argument.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: add sysfs_get_inquiry()
Martin Wilck [Mon, 18 Mar 2019 11:24:36 +0000 (12:24 +0100)]
libmultipath: add sysfs_get_inquiry()

Provide a utility function to retrieve inquiry data from
sysfs, like we do for VPDs.

Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agomultipathd: protect all access to running_state
Martin Wilck [Thu, 11 Apr 2019 10:27:14 +0000 (12:27 +0200)]
multipathd: protect all access to running_state

Chonyun Wu's latest patch has shown that the handling of the daemon
state variable running_state is racy and difficult to get right. It's
not a good candidate for a "benign race" annotation. So, as a first
step to sanitizing it, make sure all accesses to the state variable
are protected by config_lock.

The patch also replaces "if" with "while" in several places where the
code was supposed to wait until a certain state was reached. It's
important that DAEMON_SHUTDOWN terminates all loops of this kind.

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agomultipathd: fix daemon not really shutdown
Chongyun Wu [Thu, 11 Apr 2019 10:27:13 +0000 (12:27 +0200)]
multipathd: fix daemon not really shutdown

Test environment: 25 hosts, each host have more than 100 luns,
each lun have two paths.
Some times when we try to ceate new multipath will encounter "could
not create uxsock:98" but the multipathd still running not shutdown
and can't response any multipathd commands also.

After reproduce this issue and debug, found below fixes might work:
(1) set_config_state() after pthread_cond_timedwait() other threads
might changed the running_state from DAEMON_SHUTDOWN to other status
like DAEMON_IDLE, which will make the shutdown process stopped.
I found logs to prove this really happened, so we need add judgement
here too.

(2) [this part removed by mwilck]

Signed-off-by: Chongyun Wu <wu.chongyun@h3c.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agomultipath-tools: Build: properly parse systemd's version
Dominique Leuenberger [Thu, 11 Apr 2019 10:27:12 +0000 (12:27 +0200)]
multipath-tools: Build: properly parse systemd's version

Since systemd 241, systemctl --version no longer 'just' prints out the
version, but gives more information like git commit ref and whatnot. In
it's shortest form, it gives something like "systemd 241 (241)", which when
passed as parameter "-DUSE_SYSTEMD=241 (241)" results in shell errors.

Try to retrieve the version from pkg-config instead, and if that fails,
discard anything after the first number in "systemctl --version" output.

Acked-by: Benjamin Marzinski <bmarzins@redhat.com>
Acked-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
5 months agolibmultipath: silence dm_is_mpath error messages
Benjamin Marzinski [Sat, 30 Mar 2019 06:06:06 +0000 (01:06 -0500)]
libmultipath: silence dm_is_mpath error messages

When "multipath -F" is run, dm_is_mpath was printing error messages
about partition devices, because they had already been removed, when
it checked.  Lower the error logging level so this doesn't happen on
the default verbosity.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agomultipathd: Don't use fallback code after getting wwid
Benjamin Marzinski [Sat, 30 Mar 2019 06:06:05 +0000 (01:06 -0500)]
multipathd: Don't use fallback code after getting wwid

The fallback code is necessary to set up mutipath devices, if multipath
temporarily can't get the information from udev.  However, once the
devices are set up, udev is the definitive source of this information.

The wwid gotten from the fallback code and the udev code should always
be the same, in which case it doesn't matter where we get the wwid
from. But if they are different, it's important to try to do the
right thing.

Working under the assumption that udev will either never give us this
information, or that it usually will. multipath should assume that if
there are multiple paths to a device, either they will all never get
a wwid from udev, or some of them will likely already have gotten the
correct wwid from udev.  In this case, we should fix this as soon as
possible.

This does mean that devices where udev will never give out the uuid
will not notice if the wwid changes, but that's a small price to pay
for doing the right thing most of the time.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agomultipathd: ignore "disable_changed_wwids"
Martin Wilck [Sat, 30 Mar 2019 06:06:04 +0000 (01:06 -0500)]
multipathd: ignore "disable_changed_wwids"

This option has no effect any more.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agomultipathd: remove "wwid_changed" path attribute
Martin Wilck [Sat, 30 Mar 2019 06:06:03 +0000 (01:06 -0500)]
multipathd: remove "wwid_changed" path attribute

This is now not needed any more.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agomultipathd: handle changed wwids by removal and addition
Benjamin Marzinski [Sat, 30 Mar 2019 06:06:02 +0000 (01:06 -0500)]
multipathd: handle changed wwids by removal and addition

If a path's WWID changes, it's not necessarily failed. But it certainly
has to be removed from an existing map, otherwise data corruption is
imminent. Instead of keeping the path in the map, failing it, and
remembering the "changed WWID" state, this patch simply removes and
re-adds the path.

This is patch is heavily based on the previous patch of the same name
by Martin Wilck.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agolibmulitpath: cleanup uid_fallback code
Benjamin Marzinski [Sat, 30 Mar 2019 06:06:01 +0000 (01:06 -0500)]
libmulitpath: cleanup uid_fallback code

Instead of always calling uid_fallback() if the configured method to get
the uid failed, get_uid now checks if the path supports fallbacks and if
all the retriggers have occurred. If so, it calls uid_fallback(), which
just attempts to get the uid using the appropriate fallback method. None
of these changes should make the code function any differently.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agolibmultipath: add get_uid fallback code for NVMe devices
Benjamin Marzinski [Sat, 30 Mar 2019 06:06:00 +0000 (01:06 -0500)]
libmultipath: add get_uid fallback code for NVMe devices

If multipath can't get the uid for NVMe devices from udev, it can get it
directly from sysfs.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agomultipath.conf: add missing options to man page
Benjamin Marzinski [Sat, 30 Mar 2019 06:05:59 +0000 (01:05 -0500)]
multipath.conf: add missing options to man page

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agomultipathd: use update_path_groups instead of reload_map
Benjamin Marzinski [Sat, 30 Mar 2019 06:05:58 +0000 (01:05 -0500)]
multipathd: use update_path_groups instead of reload_map

reload_map() doesn't do the work to sync the state after reloading the
map.  Instead of calling it directly, cli_reload() and uev_update_path()
should call update_path_groups(), which calls reload_map() with all the
necessary syncing.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agolibmutipath: continue to use old state on PATH_PENDING
Benjamin Marzinski [Sat, 30 Mar 2019 06:05:57 +0000 (01:05 -0500)]
libmutipath: continue to use old state on PATH_PENDING

When pathinfo() sets pp->state to PATH_PENDING, it can cause problems
with path checking.  It should act more like check_path(). When
check_path() sees a new state of PATH_PENDING, it doesn't update the
path state at all, so a path's old state is normally never PATH_PENDING.

As and example of the problems of setting a path to PATH_PENDING, If
check_path() sets a path's state to PATH_UP, then a call to pathinfo()
sets the state to PATH_PENDING, and then another call the check_path()
sets the state to PATH_DOWN, multipathd won't fail the path in the
kernel. Also, if a path's state is PATH_PENDING, and nr_active is
recalculated, that path will count as down, even if the state was
previously PATH_UP. If a path already has a state of PATH_WILD or
PATH_UNCHECKED, changing it to PATH_PENDING won't hurt anything, and it
will help anyone who sees it know what's actually happening. But
otherwise, pathinfo() should leave the previous state alone.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agomultipathd: ignore failed wwid recheck
Benjamin Marzinski [Sat, 30 Mar 2019 06:05:56 +0000 (01:05 -0500)]
multipathd: ignore failed wwid recheck

If disable_changed_wwids is set, when multipathd gets a change event on
a path, it verifies that the wwid hasn't changed in uev_update_path().
If get_uid() failed, uev_update_path treated this as a wwid change to 0.
This could cause paths to suddenly be dropped due to an issue with
getting the wwid.  Even if get_uid() failed because the path was down,
it no change uevent happend when it later became active, multipathd
would continue to ignore the path. Also, scsi_uid_fallback() clears the
failure return if it doesn't attempt to fallback, causing get_uid()
to return success, when it actually failed.

Multipathd should neither set nor clear wwid_changed if get_uid()
returned failure. Also, scsi_uid_fallback() should retain the old return
value if it doesn't attempt to fallback.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agomultipathd: Fix miscounting active paths
Benjamin Marzinski [Sat, 30 Mar 2019 06:05:55 +0000 (01:05 -0500)]
multipathd: Fix miscounting active paths

When multipathd gets a change uevent, it calls pathinfo with DI_NOIO.
This sets the path state to the return value of path_offline(). If a
path is in the PATH_DOWN state but path_offline() returns PATH_UP, when
that path gets a change event, its state will get moved to PATH_UP
without either reinstating the path, or reloading the map.  The next
call to check_path() will move the path back to PATH_DOWN. Since
check_path() simply increments and decrements nr_active instead of
calculating it based on the actual number of active paths, nr_active
will get decremented a second time for this failed path, potentially
putting the multipath device into recovery mode.

This commit does two things to avoid this situation. It makes the
DI_NOIO flag only set pp->state in pathinfo() if DI_CHECKER is also set.
This isn't set in uev_update_path() to avoid changing the path state in
this case.  Also, to guard against pp->state getting changed in some
other code path without properly updating the map state, check_path()
now calls set_no_path_retry, which recalculates nr_active based on the
actual number of active paths, and makes sure that the queue_if_no_path
value in the features line is correct.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agolibmultipath: fix marginal_paths nr_active check
Benjamin Marzinski [Sat, 30 Mar 2019 06:05:54 +0000 (01:05 -0500)]
libmultipath: fix marginal_paths nr_active check

Marginal paths are SHAKY, so they don't count towards the number of
active paths. poll_io_err_stat() shouldn't automatically reinstate a
marginal path if there already is an active path.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agolibmultipath: fix marginal paths queueing errors
Benjamin Marzinski [Sat, 30 Mar 2019 06:05:53 +0000 (01:05 -0500)]
libmultipath: fix marginal paths queueing errors

The current marginal paths code tries to enqueue paths for io error
checking when multipathd receives a uevent on path failure. This can run
into a couple of problems. First, this uevent could happen before or
after multipathd actually fails the path, so simply checking nr_active
doesn't tell us if this is the last active path. Also, The code to fail
the path in enqueue_io_err_stat_by_path() doesn't ever update the path
state. This can cause the path to get failed twice, temporarily leading
to incorrect nr_active counts. Further, The point when multipathd should
care if this is the last active path is when the path has come up again,
not when it goes down. Lastly, if the path is down, it is often
impossible to open the path device, causing setup_directio_ctx() to
fail, which causes multipathd to skip io error checking and mark the
path as not marginal.

Instead, multipathd should just make sure that if the path is marginal,
it gets failed in the uevent, so as not to race with the checkerloop
thread. Then, when the path comes back up, check_path() can enqueue it,
just like it does for paths that need to get rechecked. To make it
obvious that the state PATH_IO_ERR_IN_POLLING_RECHECK and the function
hit_io_err_recheck_time() now apply to paths waiting to be enqueued for
the first time as well, I've also changed their names to
PATH_IO_ERR_WAITING_TO_CHECK and need_io_err_check(), respectively.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agomultipathd: cleanup marginal paths checking timers
Benjamin Marzinski [Sat, 30 Mar 2019 06:05:52 +0000 (01:05 -0500)]
multipathd: cleanup marginal paths checking timers

When a path gets recovered in hit_io_err_recheck_time(), it will
continue running in check_path(), so there is no reason to schedule
another path check as soon as possible (since one is currently
happening).

Also, there isn't much point in restarting the io err stat checking when
the path is down, so hit_io_err_recheck_time() should only be run when
the path is up. Downed marginal paths can be treated just like any other
downed path.

Finally, there is no reason to set reset pp->io_err_dis_reinstate_time
when we decide to enqueue a path. Either th enqueue will fail and the
path will get recovered, or it will succeed, and we won't check the
reinstate time again until poll_io_err_stat() marks the path as needing
a requeue.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agolibmultipath: handle existing paths in marginal_path enqueue
Benjamin Marzinski [Sat, 30 Mar 2019 06:05:51 +0000 (01:05 -0500)]
libmultipath: handle existing paths in marginal_path enqueue

If the path that enqueue_io_err_stat_by_path() is trying to add
is already on the list, just return success. There's no reason
to fail in this case.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 months agoBZ 1668693: disable user_friendly_names for NetApp
Benjamin Marzinski [Sat, 30 Mar 2019 06:05:50 +0000 (01:05 -0500)]
BZ 1668693: disable user_friendly_names for NetApp

NetApp has tools that rely on devices using WWID names. To avoid
breaking these, NetApp devices should continue to use WWID names, even
if the default config is set to enable user_friendly_names. If users
want to use user_friendly_names on NetApp devices, the must specifically
override the device config.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
7 months agoBump version to 0.8.0 0.8.0
Christophe Varoqui [Thu, 14 Feb 2019 17:55:29 +0000 (18:55 +0100)]
Bump version to 0.8.0

7 months agomultipathd: don't resend change events for unknown devices
Benjamin Marzinski [Wed, 13 Feb 2019 22:55:08 +0000 (16:55 -0600)]
multipathd: don't resend change events for unknown devices

If multipath fails to get the wwid for a device, and the device is
of an unknown type (pp->bus == SYSFS_BUS_UNDEF), don't send change
events. Instead, assume that the device was not meant to be used
and skip it.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
7 months agomultipathd: fix pp->initialized state ping-ponging
Benjamin Marzinski [Wed, 13 Feb 2019 22:55:07 +0000 (16:55 -0600)]
multipathd: fix pp->initialized state ping-ponging

When a multipath device fails to get a wwid in pathinfo, it moves to the
INIT_MISSING_UDEV state. After a device in this state sends
retrigger_tries change uevents in check_path(), it moves to the
INIT_FAILED state.  However, when check_path() is run on a device in
INIT_FAILED, it can call pathinfo, which will set the path back
into INIT_MISSING_UDEV if it cannot get a wwid.  The next call to
check_path() will put the path back into INIT_FAILED.  The device will
continue to ping-pong between these states.

To solve this a new pp->initialized state has been added INIT_NEW.  New
path devices start in this state, instead of INIT_FAILED. INIT_NEW and
INIT_FAILED are treated exactly the same, with one exception. A device
in INIT_FAILED cannot transition back to INIT_MISSING_UDEV.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
7 months agomultipath: blacklist zram devices
Benjamin Marzinski [Wed, 13 Feb 2019 22:55:06 +0000 (16:55 -0600)]
multipath: blacklist zram devices

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
7 months agomultipathd: avoid null pointer dereference in LOG_MSG
Martin Wilck [Wed, 13 Feb 2019 22:55:05 +0000 (16:55 -0600)]
multipathd: avoid null pointer dereference in LOG_MSG

LOG_MSG() will dereference pp->mpp. Commit cb5ec664 added a call to
LOG_MSG() before the check for (!pp->mpp) in check_path.  This can cause
multipathd to crash.  LOG_MSG() should check the fields before dereferencing
them. Make checker_selected() an inline function to allow the compiler
to optimize away the usually redundant test "if (&checker->pp != NULL)".

Also, checker_message() should fail to a generic message if c->cls isn't
set (which means that a checker hasn't been selected).

Fixes: cb5ec664 (multipathd: check_path: improve logging for "unusable
                 path" case)
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
8 months agomultipath-tools: git should ignore auto-generated files
Xose Vazquez Perez [Mon, 14 Jan 2019 17:12:19 +0000 (18:12 +0100)]
multipath-tools: git should ignore auto-generated files

blacklist libmultipath/nvme-ioctl.[ch]

Cc: Martin Wilck <mwilck@suse.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
8 months agolibmultipath(coverity): fix possible NULL dereference
Martin Wilck [Tue, 8 Jan 2019 22:54:09 +0000 (23:54 +0100)]
libmultipath(coverity): fix possible NULL dereference

coverity warns that recv_packet may set reply to NULL.

Signed-off-by: Martin Wilck <mwilck@suse.com>
8 months agolibmultipath/foreign(coverity): retval check in snprint_nvme_path
Martin Wilck [Tue, 8 Jan 2019 22:54:08 +0000 (23:54 +0100)]
libmultipath/foreign(coverity): retval check in snprint_nvme_path

Signed-off-by: Martin Wilck <mwilck@suse.com>
8 months agolibmpathpersist(coverity): range checking for PRIN length
Martin Wilck [Tue, 8 Jan 2019 22:54:07 +0000 (23:54 +0100)]
libmpathpersist(coverity): range checking for PRIN length

Signed-off-by: Martin Wilck <mwilck@suse.com>
8 months agomultipathd(coverity): check retval clock_gettime()
Martin Wilck [Tue, 8 Jan 2019 22:54:06 +0000 (23:54 +0100)]
multipathd(coverity): check retval clock_gettime()

Checking this is pointless, as we'd bail out early in
pthread_cond_init_mono if CLOCK_MONOTONIC was unsupported, and this
is the only error condition of clock_gettime worth checking.
Do it anyway to make coverity feel better.

Signed-off-by: Martin Wilck <mwilck@suse.com>
8 months agolibmultipath(coverity): fix "enum misuse" for find_multipaths
Martin Wilck [Tue, 8 Jan 2019 22:54:05 +0000 (23:54 +0100)]
libmultipath(coverity): fix "enum misuse" for find_multipaths

Signed-off-by: Martin Wilck <mwilck@suse.com>
8 months agolibmultipath(coverity): fix int overflow in sysfs_set_scsi_tmo
Martin Wilck [Tue, 8 Jan 2019 22:54:04 +0000 (23:54 +0100)]
libmultipath(coverity): fix int overflow in sysfs_set_scsi_tmo

Signed-off-by: Martin Wilck <mwilck@suse.com>
8 months agolibmpathcmd(coverity): limit reply length
Martin Wilck [Tue, 8 Jan 2019 22:54:03 +0000 (23:54 +0100)]
libmpathcmd(coverity): limit reply length

coverity warned about tainted input data.

Signed-off-by: Martin Wilck <mwilck@suse.com>
8 months agolibmultipath(coverity): fix apparent overflow
Martin Wilck [Tue, 8 Jan 2019 22:54:02 +0000 (23:54 +0100)]
libmultipath(coverity): fix apparent overflow

"preferred_path" contains always "0" or "1".

Signed-off-by: Martin Wilck <mwilck@suse.com>
8 months agolibmultipath(coverity): make sure readlink result is 0-terminated
Martin Wilck [Tue, 8 Jan 2019 22:54:01 +0000 (23:54 +0100)]
libmultipath(coverity): make sure readlink result is 0-terminated

Coverity warned that readlink() results aren't necessarily 0-terminated.

Signed-off-by: Martin Wilck <mwilck@suse.com>
8 months agokpartx(coverity): fix apparent out-of-bounds access
Martin Wilck [Tue, 8 Jan 2019 22:54:00 +0000 (23:54 +0100)]
kpartx(coverity): fix apparent out-of-bounds access

This was a false positive.

Signed-off-by: Martin Wilck <mwilck@suse.com>
8 months agolibmultipath(coverity): cleanup dup usage in execute_program()
Martin Wilck [Tue, 8 Jan 2019 22:53:59 +0000 (23:53 +0100)]
libmultipath(coverity): cleanup dup usage in execute_program()

coverity complained about resource leakage here.

Signed-off-by: Martin Wilck <mwilck@suse.com>
8 months agokpartx(coverity): fix resource leak warning
Martin Wilck [Tue, 8 Jan 2019 22:53:58 +0000 (23:53 +0100)]
kpartx(coverity): fix resource leak warning

This was an easy-to-fix false positive.

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

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

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

This is pointless since we removed RBD support altogether.

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

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

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

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

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

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

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

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

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

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

Indicate ANA support in the "hwhandler" output field.

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

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

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

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

Change the data structures of the nvme foreign library
accordingly.

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

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

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

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

Furthermore, make additional cleanups in the ANA prioritizer:

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

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

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

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

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

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

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

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

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

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

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

This code is licensed under GPL v2.0.

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

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

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

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

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

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

move close_fd() into util.c.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

After the patch is applied the error no longer occur.

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

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

This patch doesn't introduce a change in behavior.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This will make log level 4 actually usable.

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

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

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

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

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

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

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

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

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>