134254a5b4
Update Source to latest upstream commit * Previous patches 0001-0003 are included in this version Rename files * Previous patches 0004-0011 are now patches 0002-0009 Add 0001-libmultipath-dm_is_mpath-cleanup.patch * This patch has been submitted upstream
93 lines
2.3 KiB
Diff
93 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Date: Tue, 11 Dec 2018 14:11:19 -0600
|
|
Subject: [PATCH] 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"
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
---
|
|
libmultipath/devmapper.c | 21 ++++++++++++---------
|
|
multipathd/dmevents.c | 4 +++-
|
|
2 files changed, 15 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
|
|
index 0e98923..3294bd4 100644
|
|
--- a/libmultipath/devmapper.c
|
|
+++ b/libmultipath/devmapper.c
|
|
@@ -709,41 +709,44 @@ int dm_is_mpath(const char *name)
|
|
const char *uuid;
|
|
|
|
if (!(dmt = libmp_dm_task_create(DM_DEVICE_TABLE)))
|
|
- return -1;
|
|
+ goto out;
|
|
|
|
if (!dm_task_set_name(dmt, name))
|
|
- goto out;
|
|
+ goto out_task;
|
|
|
|
dm_task_no_open_count(dmt);
|
|
|
|
if (!dm_task_run(dmt))
|
|
- goto out;
|
|
+ goto out_task;
|
|
|
|
if (!dm_task_get_info(dmt, &info))
|
|
- goto out;
|
|
+ goto out_task;
|
|
|
|
r = 0;
|
|
|
|
if (!info.exists)
|
|
- goto out;
|
|
+ goto out_task;
|
|
|
|
uuid = dm_task_get_uuid(dmt);
|
|
|
|
if (!uuid || strncmp(uuid, UUID_PREFIX, UUID_PREFIX_LEN) != 0)
|
|
- goto out;
|
|
+ goto out_task;
|
|
|
|
/* Fetch 1st target */
|
|
if (dm_get_next_target(dmt, NULL, &start, &length, &target_type,
|
|
¶ms) != NULL)
|
|
/* multiple targets */
|
|
- goto out;
|
|
+ goto out_task;
|
|
|
|
if (!target_type || strcmp(target_type, TGT_MPATH) != 0)
|
|
- goto out;
|
|
+ goto out_task;
|
|
|
|
r = 1;
|
|
-out:
|
|
+out_task:
|
|
dm_task_destroy(dmt);
|
|
+out:
|
|
+ if (r < 0)
|
|
+ condlog(2, "%s: dm command failed in %s", name, __FUNCTION__);
|
|
return r;
|
|
}
|
|
|
|
diff --git a/multipathd/dmevents.c b/multipathd/dmevents.c
|
|
index aae7a09..0034892 100644
|
|
--- a/multipathd/dmevents.c
|
|
+++ b/multipathd/dmevents.c
|
|
@@ -206,7 +206,9 @@ int watch_dmevents(char *name)
|
|
struct dev_event *dev_evt, *old_dev_evt;
|
|
int i;
|
|
|
|
- if (!dm_is_mpath(name)) {
|
|
+ /* We know that this is a multipath device, so only fail if
|
|
+ * device-mapper tells us that we're wrong */
|
|
+ if (dm_is_mpath(name) == 0) {
|
|
condlog(0, "%s: not a multipath device. can't watch events",
|
|
name);
|
|
return -1;
|
|
--
|
|
2.17.2
|
|
|