[dm-devel] [PATCH v3 3/3] multipathd: skip spurious event message for blacklisted paths
Hannes Reinecke
hare at suse.de
Wed Dec 14 07:05:30 UTC 2016
On 12/14/2016 03:02 AM, Mauricio Faria de Oliveira wrote:
> Currently, multipath still prints the 'spurious uevent, path not found'
> message if a path is blacklisted by something different than a devnode
> in the 'change' uevent handling. (uev_trigger() calls filter_devnode()).
>
> Thus blacklisting by vendor/product, wwid, and udev property still get
> that message in the system log for paths that are explicitly marked to
> be ignored (since it's verbosity level 0).
>
> This problem happens on common scenarios such as creating filesystems
> on a blacklisted device (e.g., mkfs.* /dev/sdX), which is usually run
> several times on test environments, and the error message may mislead
> the error checker/monitor tools with false negatives.
>
> This patch resolves this by checking alloc_path_with_pathinfo()
> for PATHINFO_SKIPPED with just enough device information flags for
> blacklist verification -- and it prints a debug message (verbosity
> level 3) instead of an error message since this case is not an error.
>
> Even though this introduces a bit of overhead (to get the path info),
> it only happens in a corner case of an error path; so, not a problem.
>
> Test-cases (on QEMU):
> ----------
>
> Several versions of /etc/multipath.conf:
>
> blacklist {
> devnode "sdb"
> }
>
> blacklist {
> property "ID_SERIAL"
> }
>
> blacklist {
> wwid "0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-1"
> }
>
> blacklist {
> device {
> vendor "QEMU"
> }
> }
>
> Either command can be used to generate a 'change' uevent:
>
> # echo change > /sys/block/sdb/uevent
>
> # mkfs.ext3 -F /dev/sdb
>
> The output of multipathd is monitored with:
>
> # multipathd -d -s
> ...
>
> Without the patch, only the devnode blacklisting is silent;
> all other cases (property, wwid, device) print the message:
>
> sdb: spurious uevent, path not found
>
> With the patch applied, no message is printed by default
> (that is, verbosity level 2) in any case.
>
> With verbosity level 3 (debug), the following messages
> are printed, according to the performed test-case:
>
> sdb: udev property ID_SERIAL blacklisted
> sdb: spurious uevent, path is blacklisted
>
> sdb: wwid 0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-1 blacklisted
> sdb: spurious uevent, path is blacklisted
>
> (null): (QEMU:QEMU HARDDISK) vendor/product blacklisted
> sdb: spurious uevent, path is blacklisted
>
> Reported-by: Yueh Chyong (Ida) Jackson <idaj at us.ibm.com>
> Signed-off-by: Mauricio Faria de Oliveira <mauricfo at linux.vnet.ibm.com>
> ---
> multipathd/main.c | 23 ++++++++++++++++++++++-
> 1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/multipathd/main.c b/multipathd/main.c
> index d6f081f2f83a..ee7a410e4782 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -1010,8 +1010,29 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
> }
> out:
> lock_cleanup_pop(vecs->lock);
> - if (!pp)
> + if (!pp) {
> + /*
> + * If the path is blacklisted, print a debug/non-default verbosity message.
> + * - filter_devnode() - checked by uev_trigger() (caller);
> + * - filter_device() - checked by pathinfo() (DI_BLACKLIST | DI_SYSFS);
> + * - filter_wwid() - checked by pathinfo() (DI_BLACKLIST | DI_WWID);
> + * - filter_property() - checked by pathinfo() (DI_BLACKLIST)
> + */
> + if (uev->udev) {
> + int flag = DI_SYSFS | DI_WWID;
> +
> + conf = get_multipath_config();
> + retval = alloc_path_with_pathinfo(conf, uev->udev, flag, NULL);
> + put_multipath_config(conf);
> +
> + if (retval == PATHINFO_SKIPPED) {
> + condlog(3, "%s: spurious uevent, path is blacklisted", uev->kernel);
> + return 0;
> + }
> + }
> +
> condlog(0, "%s: spurious uevent, path not found", uev->kernel);
> + }
>
> return retval;
> }
>
Reviewed-by: Hannes Reinecke <hare at suse.com>
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare at suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
More information about the dm-devel
mailing list