device-mapper-multipath-0.7.9-1

Update Source to upstream version 0.7.9
  * Previous patches 0001-0006 are included in this version
Rename files
  * Previous patches 0007-0014 are now patches 0004-0011
Add 0001-multipathd-fix-mpp-hwe-handling-when-paths-are-freed.patch
Add 0002-libmultipath-cleanup-pthread_cleanup_pop-call.patch
Add 0003-libmultipath-fix-false-removes-in-dmevents-polling-c.patch
  * The above 3 patches have been submitted upstream
This commit is contained in:
Benjamin Marzinski 2018-12-03 15:24:23 -06:00
parent e1b782c112
commit 170e923cae
20 changed files with 435 additions and 519 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@ multipath-tools-091027.tar.gz
/multipath-tools-1a8625a.tgz
/multipath-tools-b80318b.tgz
/multipath-tools-0.7.8.tgz
/multipath-tools-0.7.9.tgz

View File

@ -1,59 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 26 Sep 2018 16:08:59 -0500
Subject: [PATCH] multipath: tweak logging style
When multipathd commands are run, errors should be printed to stderr,
instead of syslog. Also, when the multipath is run and calls
device-mapper, device-mapper should log to stderr instead of stdout,
just like multipath does now.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/devmapper.c | 8 ++++----
multipathd/main.c | 2 ++
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 8136d15..0433b49 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -80,11 +80,11 @@ dm_write_log (int level, const char *file, int line, const char *f, ...)
strftime(buff, sizeof(buff), "%b %d %H:%M:%S", tb);
buff[sizeof(buff)-1] = '\0';
- fprintf(stdout, "%s | ", buff);
+ fprintf(stderr, "%s | ", buff);
}
- fprintf(stdout, "libdevmapper: %s(%i): ", file, line);
- vfprintf(stdout, f, ap);
- fprintf(stdout, "\n");
+ fprintf(stderr, "libdevmapper: %s(%i): ", file, line);
+ vfprintf(stderr, f, ap);
+ fprintf(stderr, "\n");
} else {
condlog(level, "libdevmapper: %s(%i): ", file, line);
log_safe(level + 3, f, ap);
diff --git a/multipathd/main.c b/multipathd/main.c
index af33239..5f0193b 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2984,6 +2984,7 @@ main (int argc, char *argv[])
logsink = -1;
break;
case 'k':
+ logsink = 0;
conf = load_config(DEFAULT_CONFIGFILE);
if (!conf)
exit(1);
@@ -3013,6 +3014,7 @@ main (int argc, char *argv[])
char * s = cmd;
char * c = s;
+ logsink = 0;
conf = load_config(DEFAULT_CONFIGFILE);
if (!conf)
exit(1);
--
2.7.4

View File

@ -0,0 +1,111 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 20 Nov 2018 22:24:44 -0600
Subject: [PATCH] multipathd: fix mpp->hwe handling when paths are freed
Commit 1f962693 didn't deal with all of cases where a path that was part
of a multipath device could be removed. verify_paths() removes any path
that no longer exists in sysfs. mpp->hwe needs to be updated here as
well, since verify_paths() could remove the path whose hwe vector is
pointed to by mpp->hwe. Also, now that extract_hwe_from_path() is
called in verify_paths(), the extract_hwe_from_path() calls that
happened immediately after verify_paths() can be dropped.
The other part of this fix is mostly cosmetic. In ev_add_path(), if
domap() fails after the path is added to the multipath device and
verify_paths() is called, the code can loop back to the rescan label. If
the size of the path or the multipath device changed in the interim,
ev_add_path() would remove the path, without updating mpp->hwe; but
there is no way for the size to change. Just to make that clearer in the
code, I've moved the size check to before the rescan label so it only
happens once.
Fixes: 1f962693 "multipathd: fix mpp->hwe handling on path removal"
Cc: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/structs_vec.c | 7 +++++++
multipathd/main.c | 21 ++++++++-------------
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index c85823a..e28a88a 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -407,6 +407,12 @@ int verify_paths(struct multipath *mpp, struct vectors *vecs)
vector_del_slot(mpp->paths, i);
i--;
+ /* Make sure mpp->hwe doesn't point to freed memory.
+ * We call extract_hwe_from_path() below to restore
+ * mpp->hwe
+ */
+ if (mpp->hwe == pp->hwe)
+ mpp->hwe = NULL;
if ((j = find_slot(vecs->pathvec,
(void *)pp)) != -1)
vector_del_slot(vecs->pathvec, j);
@@ -416,6 +422,7 @@ int verify_paths(struct multipath *mpp, struct vectors *vecs)
mpp->alias, pp->dev, pp->dev_t);
}
}
+ extract_hwe_from_path(mpp);
return count;
}
diff --git a/multipathd/main.c b/multipathd/main.c
index cc555bb..2e5f9ed 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -491,7 +491,6 @@ retry:
verify_paths(mpp, vecs);
mpp->action = ACT_RELOAD;
- extract_hwe_from_path(mpp);
if (setup_map(mpp, params, PARAMS_SIZE, vecs)) {
condlog(0, "%s: failed to setup new map in update", mpp->alias);
retries = -1;
@@ -925,6 +924,14 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
goto fail; /* leave path added to pathvec */
}
mpp = find_mp_by_wwid(vecs->mpvec, pp->wwid);
+ if (mpp && pp->size && mpp->size != pp->size) {
+ condlog(0, "%s: failed to add new path %s, device size mismatch", mpp->alias, pp->dev);
+ int i = find_slot(vecs->pathvec, (void *)pp);
+ if (i != -1)
+ vector_del_slot(vecs->pathvec, i);
+ free_path(pp);
+ return 1;
+ }
if (mpp && mpp->wait_for_udev &&
(pathcount(mpp, PATH_UP) > 0 ||
(pathcount(mpp, PATH_GHOST) > 0 && pp->tpgs != TPGS_IMPLICIT &&
@@ -940,17 +947,6 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
pp->mpp = mpp;
rescan:
if (mpp) {
- if (pp->size && mpp->size != pp->size) {
- condlog(0, "%s: failed to add new path %s, "
- "device size mismatch",
- mpp->alias, pp->dev);
- int i = find_slot(vecs->pathvec, (void *)pp);
- if (i != -1)
- vector_del_slot(vecs->pathvec, i);
- free_path(pp);
- return 1;
- }
-
condlog(4,"%s: adopting all paths for path %s",
mpp->alias, pp->dev);
if (adopt_paths(vecs->pathvec, mpp))
@@ -958,7 +954,6 @@ rescan:
verify_paths(mpp, vecs);
mpp->action = ACT_RELOAD;
- extract_hwe_from_path(mpp);
} else {
if (!should_multipath(pp, vecs->pathvec, vecs->mpvec)) {
orphan_path(pp, "only one path");
--
2.17.2

View File

@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Mon, 26 Nov 2018 16:42:24 -0600
Subject: [PATCH] libmultipath: cleanup pthread_cleanup_pop call
pthread_cleanup_push() and pthread_cleanup_pop() must be called in the
same lexical scope. In uevent_listen(), the pthread_cleanup_pop() call
to cleanup the udev monitor is called in a nested 'if' block, within
the block where pthread_cleanup_push() is called. Since this is a
single-statement if block, it doesn't actually cause any problems, but
it should be fixed anyways.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/uevent.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index 5f910e6..f73de8c 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -806,7 +806,7 @@ int uevent_listen(struct udev *udev)
monitor = udev_monitor_new_from_netlink(udev, "udev");
if (!monitor) {
condlog(2, "failed to create udev monitor");
- goto out;
+ goto failback;
}
pthread_cleanup_push(monitor_cleanup, monitor);
#ifdef LIBUDEV_API_RECVBUF
@@ -893,8 +893,8 @@ int uevent_listen(struct udev *udev)
}
need_failback = 0;
out:
- if (monitor)
- pthread_cleanup_pop(1);
+ pthread_cleanup_pop(1);
+failback:
if (need_failback)
err = failback_listen();
pthread_cleanup_pop(1);
--
2.17.2

View File

@ -1,31 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 5 Oct 2018 17:20:38 -0500
Subject: [PATCH] multipathd: check for NULL udevice in cli_add_path
If cli_add_path can't get a udevice for the path, it should fail,
instead of continuing with a NULL udevice.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/cli_handlers.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index bb16472..7500080 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -720,6 +720,10 @@ cli_add_path (void * v, char ** reply, int * len, void * data)
udevice = udev_device_new_from_subsystem_sysname(udev,
"block",
param);
+ if (!udevice) {
+ condlog(0, "%s: can't find path", param);
+ return 1;
+ }
conf = get_multipath_config();
pthread_cleanup_push(put_multipath_config, conf);
r = store_pathinfo(vecs->pathvec, conf,
--
2.7.4

View File

@ -0,0 +1,204 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 27 Nov 2018 22:50:57 -0600
Subject: [PATCH] libmultipath: fix false removes in dmevents polling code
dm_is_mpath() would return 0 if either a device was not a multipath
device or if the libdevmapper command failed. Because dm_is_mpath()
didn't distinguish between these situations, dm_get_events() could
assume that a device was not really a multipath device, when in fact it
was, and the libdevmapper command simply failed. This would cause the
dmevents polling waiter to stop monitoring the device.
In reality, the call to dm_is_mpath() isn't necessary, because
dm_get_events() will already verify that the device name is on the list
of devices to wait for. However, if there are a large number of
non-multipath devices on the system, ignoring them can be useful. Thus,
if dm_is_mpath() successfully runs the libdevmapper command and verifies
that the device is not a multipath device, dm_get_events() should skip
it. But if the libdevmapper command fails, dm_get_events() should still
check the device list, to see if the device should be monitored.
This commit makes dm_is_mpath() return -1 for situations where
the libdevmapper command failed, and makes dm_get_events() only ignore
the device on a return of 0.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathpersist/mpath_persist.c | 4 ++--
libmultipath/devmapper.c | 41 +++++++++++++++++++++++----------
multipath/main.c | 2 +-
multipathd/dmevents.c | 8 +++++--
multipathd/main.c | 2 +-
5 files changed, 39 insertions(+), 18 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 2ffe56e..7e8a676 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -188,7 +188,7 @@ int mpath_persistent_reserve_in (int fd, int rq_servact,
condlog(3, "alias = %s", alias);
map_present = dm_map_present(alias);
- if (map_present && !dm_is_mpath(alias)){
+ if (map_present && dm_is_mpath(alias) != 1){
condlog( 0, "%s: not a multipath device.", alias);
ret = MPATH_PR_DMMP_ERROR;
goto out;
@@ -283,7 +283,7 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
condlog(3, "alias = %s", alias);
map_present = dm_map_present(alias);
- if (map_present && !dm_is_mpath(alias)){
+ if (map_present && dm_is_mpath(alias) != 1){
condlog(3, "%s: not a multipath device.", alias);
ret = MPATH_PR_DMMP_ERROR;
goto out;
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 0433b49..3294bd4 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -692,9 +692,15 @@ out:
return r;
}
+/*
+ * returns:
+ * 1 : is multipath device
+ * 0 : is not multipath device
+ * -1 : error
+ */
int dm_is_mpath(const char *name)
{
- int r = 0;
+ int r = -1;
struct dm_task *dmt;
struct dm_info info;
uint64_t start, length;
@@ -703,33 +709,44 @@ int dm_is_mpath(const char *name)
const char *uuid;
if (!(dmt = libmp_dm_task_create(DM_DEVICE_TABLE)))
- return 0;
+ 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) || !info.exists)
- goto out;
+ if (!dm_task_get_info(dmt, &info))
+ goto out_task;
+
+ r = 0;
+
+ if (!info.exists)
+ 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 */
- dm_get_next_target(dmt, NULL, &start, &length, &target_type, &params);
+ if (dm_get_next_target(dmt, NULL, &start, &length, &target_type,
+ &params) != NULL)
+ /* multiple targets */
+ 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;
}
@@ -823,7 +840,7 @@ int _dm_flush_map (const char * mapname, int need_sync, int deferred_remove,
unsigned long long mapsize;
char params[PARAMS_SIZE] = {0};
- if (!dm_is_mpath(mapname))
+ if (dm_is_mpath(mapname) != 1)
return 0; /* nothing to do */
/* if the device currently has no partitions, do not
@@ -1087,7 +1104,7 @@ dm_get_maps (vector mp)
}
do {
- if (!dm_is_mpath(names->name))
+ if (dm_is_mpath(names->name) != 1)
goto next;
mpp = dm_get_multipath(names->name);
diff --git a/multipath/main.c b/multipath/main.c
index 05b7bf0..98fee1c 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -319,7 +319,7 @@ static int check_usable_paths(struct config *conf,
goto out;
}
- if (!dm_is_mpath(mapname)) {
+ if (dm_is_mpath(mapname) != 1) {
condlog(1, "%s is not a multipath map", devpath);
goto free;
}
diff --git a/multipathd/dmevents.c b/multipathd/dmevents.c
index 31e64a7..0034892 100644
--- a/multipathd/dmevents.c
+++ b/multipathd/dmevents.c
@@ -168,7 +168,9 @@ static int dm_get_events(void)
while (names->dev) {
uint32_t event_nr;
- if (!dm_is_mpath(names->name))
+ /* Don't delete device if dm_is_mpath() fails without
+ * checking the device type */
+ if (dm_is_mpath(names->name) == 0)
goto next;
event_nr = dm_event_nr(names);
@@ -204,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;
diff --git a/multipathd/main.c b/multipathd/main.c
index 2e5f9ed..c781115 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -699,7 +699,7 @@ ev_add_map (char * dev, const char * alias, struct vectors * vecs)
int delayed_reconfig, reassign_maps;
struct config *conf;
- if (!dm_is_mpath(alias)) {
+ if (dm_is_mpath(alias) != 1) {
condlog(4, "%s: not a multipath map", alias);
return 0;
}
--
2.17.2

View File

@ -1,188 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Mon, 8 Oct 2018 11:41:03 -0500
Subject: [PATCH] libmultipath: remove max_fds code duplication
Instead of multipath, multipathd, and mpathpersist all having code to
set the max number of open file descriptors, just use a util function to
do it.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathpersist/mpath_persist.c | 11 +----------
libmultipath/util.c | 31 +++++++++++++++++++++++++++++++
libmultipath/util.h | 1 +
multipath/main.c | 12 +-----------
multipathd/main.c | 31 +++----------------------------
5 files changed, 37 insertions(+), 49 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 4229a94..29e7fb4 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -31,7 +31,6 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <sys/resource.h>
#define __STDC_FORMAT_MACROS 1
@@ -48,15 +47,7 @@ mpath_lib_init (void)
return NULL;
}
- if (conf->max_fds) {
- struct rlimit fd_limit;
-
- fd_limit.rlim_cur = conf->max_fds;
- fd_limit.rlim_max = conf->max_fds;
- if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0)
- condlog(0, "can't set open fds limit to %d : %s",
- conf->max_fds, strerror(errno));
- }
+ set_max_fds(conf->max_fds);
return conf;
}
diff --git a/libmultipath/util.c b/libmultipath/util.c
index 347af5b..d08112d 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -7,6 +7,8 @@
#include <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/utsname.h>
+#include <sys/time.h>
+#include <sys/resource.h>
#include <dirent.h>
#include <unistd.h>
#include <errno.h>
@@ -465,3 +467,32 @@ int safe_write(int fd, const void *buf, size_t count)
}
return 0;
}
+
+void set_max_fds(int max_fds)
+{
+ struct rlimit fd_limit;
+
+ if (!max_fds)
+ return;
+
+ if (getrlimit(RLIMIT_NOFILE, &fd_limit) < 0) {
+ condlog(0, "can't get open fds limit: %s",
+ strerror(errno));
+ fd_limit.rlim_cur = 0;
+ fd_limit.rlim_max = 0;
+ }
+ if (fd_limit.rlim_cur < max_fds) {
+ fd_limit.rlim_cur = max_fds;
+ if (fd_limit.rlim_max < max_fds)
+ fd_limit.rlim_max = max_fds;
+ if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) {
+ condlog(0, "can't set open fds limit to "
+ "%lu/%lu : %s",
+ fd_limit.rlim_cur, fd_limit.rlim_max,
+ strerror(errno));
+ } else {
+ condlog(3, "set open fds limit to %lu/%lu",
+ fd_limit.rlim_cur, fd_limit.rlim_max);
+ }
+ }
+}
diff --git a/libmultipath/util.h b/libmultipath/util.h
index 56cec76..c246295 100644
--- a/libmultipath/util.h
+++ b/libmultipath/util.h
@@ -21,6 +21,7 @@ int get_linux_version_code(void);
int parse_prkey(char *ptr, uint64_t *prkey);
int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags);
int safe_write(int fd, const void *buf, size_t count);
+void set_max_fds(int max_fds);
#define KERNEL_VERSION(maj, min, ptc) ((((maj) * 256) + (min)) * 256 + (ptc))
diff --git a/multipath/main.c b/multipath/main.c
index d5aad95..05b7bf0 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -56,8 +56,6 @@
#include "pgpolicies.h"
#include "version.h"
#include <errno.h>
-#include <sys/time.h>
-#include <sys/resource.h>
#include "wwids.h"
#include "uxsock.h"
#include "mpath_cmd.h"
@@ -1002,15 +1000,7 @@ main (int argc, char *argv[])
logsink = 1;
}
- if (conf->max_fds) {
- struct rlimit fd_limit;
-
- fd_limit.rlim_cur = conf->max_fds;
- fd_limit.rlim_max = conf->max_fds;
- if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0)
- condlog(0, "can't set open fds limit to %d : %s",
- conf->max_fds, strerror(errno));
- }
+ set_max_fds(conf->max_fds);
libmp_udev_set_sync_support(1);
diff --git a/multipathd/main.c b/multipathd/main.c
index 5f0193b..d3f7719 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -12,8 +12,6 @@
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
-#include <sys/time.h>
-#include <sys/resource.h>
#include <limits.h>
#include <linux/oom.h>
#include <libudev.h>
@@ -2663,33 +2661,10 @@ child (void * param)
envp = getenv("LimitNOFILE");
- if (envp) {
+ if (envp)
condlog(2,"Using systemd provided open fds limit of %s", envp);
- } else if (conf->max_fds) {
- struct rlimit fd_limit;
-
- if (getrlimit(RLIMIT_NOFILE, &fd_limit) < 0) {
- condlog(0, "can't get open fds limit: %s",
- strerror(errno));
- fd_limit.rlim_cur = 0;
- fd_limit.rlim_max = 0;
- }
- if (fd_limit.rlim_cur < conf->max_fds) {
- fd_limit.rlim_cur = conf->max_fds;
- if (fd_limit.rlim_max < conf->max_fds)
- fd_limit.rlim_max = conf->max_fds;
- if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) {
- condlog(0, "can't set open fds limit to "
- "%lu/%lu : %s",
- fd_limit.rlim_cur, fd_limit.rlim_max,
- strerror(errno));
- } else {
- condlog(3, "set open fds limit to %lu/%lu",
- fd_limit.rlim_cur, fd_limit.rlim_max);
- }
- }
-
- }
+ else
+ set_max_fds(conf->max_fds);
vecs = gvecs = init_vecs();
if (!vecs)
--
2.7.4

View File

@ -65,7 +65,7 @@ index 0828a8f..b9bbb3c 100644
$(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
diff --git a/multipath/main.c b/multipath/main.c
index 05b7bf0..ffa5b22 100644
index 98fee1c..856202a 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -401,7 +401,7 @@ static int find_multipaths_check_timeout(const struct path *pp, long tmo,
@ -78,5 +78,5 @@ index 05b7bf0..ffa5b22 100644
clock_gettime(CLOCK_REALTIME, &now);
--
2.7.4
2.17.2

View File

@ -1,98 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Mon, 8 Oct 2018 14:49:30 -0500
Subject: [PATCH] multipathd: set return code for multipathd commands
Failed multipathd commands should set the return code to 1.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 8 ++++----
multipathd/uxclnt.c | 13 ++++++++-----
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index d3f7719..2d45d98 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2966,9 +2966,9 @@ main (int argc, char *argv[])
if (verbosity)
conf->verbosity = verbosity;
uxsock_timeout = conf->uxsock_timeout;
- uxclnt(optarg, uxsock_timeout + 100);
+ err = uxclnt(optarg, uxsock_timeout + 100);
free_config(conf);
- exit(0);
+ return err;
case 'B':
bindings_read_only = 1;
break;
@@ -3005,9 +3005,9 @@ main (int argc, char *argv[])
optind++;
}
c += snprintf(c, s + CMDSIZE - c, "\n");
- uxclnt(s, uxsock_timeout + 100);
+ err = uxclnt(s, uxsock_timeout + 100);
free_config(conf);
- exit(0);
+ return err;
}
if (foreground) {
diff --git a/multipathd/uxclnt.c b/multipathd/uxclnt.c
index 08db0e8..a76f8e2 100644
--- a/multipathd/uxclnt.c
+++ b/multipathd/uxclnt.c
@@ -103,14 +103,14 @@ static void process(int fd, unsigned int timeout)
}
}
-static void process_req(int fd, char * inbuf, unsigned int timeout)
+static int process_req(int fd, char * inbuf, unsigned int timeout)
{
char *reply;
int ret;
if (send_packet(fd, inbuf) != 0) {
printf("cannot send packet\n");
- return;
+ return 1;
}
ret = recv_packet(fd, &reply, timeout);
if (ret < 0) {
@@ -118,9 +118,12 @@ static void process_req(int fd, char * inbuf, unsigned int timeout)
printf("timeout receiving packet\n");
else
printf("error %d receiving packet\n", ret);
+ return 1;
} else {
printf("%s", reply);
+ ret = (strcmp(reply, "fail\n") == 0);
FREE(reply);
+ return ret;
}
}
@@ -129,16 +132,16 @@ static void process_req(int fd, char * inbuf, unsigned int timeout)
*/
int uxclnt(char * inbuf, unsigned int timeout)
{
- int fd;
+ int fd, ret = 0;
fd = mpath_connect();
if (fd == -1)
exit(1);
if (inbuf)
- process_req(fd, inbuf, timeout);
+ ret = process_req(fd, inbuf, timeout);
else
process(fd, timeout);
mpath_disconnect(fd);
- return 0;
+ return ret;
}
--
2.7.4

View File

@ -76,5 +76,5 @@ index 6333366..3dab26b 100644
.B protocol
Regular expression for the protocol of a device to be excluded/included.
--
2.7.4
2.17.2

View File

@ -1,39 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Mon, 8 Oct 2018 16:45:11 -0500
Subject: [PATCH] mpathpersist: fix registration rollback issue
When mpathpersist tries to rollback the registration, it copies
the SARK to the RK, and clears the SARK. However, it repeated this step
for each thread. This means that the first rollback thread correctly
had the RK set to the SARK used during registration. However, if more
than one registration needed to be rolled back, later threads would have
both the RK and SARK cleared. This commit fixes that by only copying and
clearing the SARK once.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathpersist/mpath_persist.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 29e7fb4..2ffe56e 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -559,11 +559,10 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,
}
if (rollback && ((rq_servact == MPATH_PROUT_REG_SA) && sa_key != 0 )){
condlog (3, "%s: ERROR: initiating pr out rollback", mpp->wwid);
+ memcpy(&paramp->key, &paramp->sa_key, 8);
+ memset(&paramp->sa_key, 0, 8);
for( i=0 ; i < count ; i++){
if(thread[i].param.status == MPATH_PR_SUCCESS) {
- memcpy(&thread[i].param.paramp->key, &thread[i].param.paramp->sa_key, 8);
- memset(&thread[i].param.paramp->sa_key, 0, 8);
- thread[i].param.status = MPATH_PR_SUCCESS;
rc = pthread_create(&thread[i].id, &attr, mpath_prout_pthread_fn,
(void *)(&thread[i].param));
if (rc){
--
2.7.4

View File

@ -20,7 +20,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
5 files changed, 20 insertions(+)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index 0aef186..6a9340a 100644
index 5af7af5..2a9c668 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -26,6 +26,7 @@
@ -31,7 +31,7 @@ index 0aef186..6a9340a 100644
static int
hwe_strmatch (const struct hwentry *hwe1, const struct hwentry *hwe2)
@@ -745,6 +746,20 @@ load_config (char * file)
@@ -743,6 +744,20 @@ load_config (char * file)
goto out;
}
factorize_hwtable(conf->hwtable, builtin_hwtable_size, file);
@ -65,7 +65,7 @@ index 7d0cd9a..d7fb8e2 100644
/*
* In kernel, fast_io_fail == 0 means immediate failure on rport delete.
diff --git a/multipath/multipath.rules b/multipath/multipath.rules
index d658073..b3f54d7 100644
index 9df11a9..0486bf7 100644
--- a/multipath/multipath.rules
+++ b/multipath/multipath.rules
@@ -9,6 +9,7 @@ IMPORT{cmdline}="nompath"
@ -102,5 +102,5 @@ index ba24983..17434ce 100644
Conflicts=shutdown.target
ConditionKernelCommandLine=!nompath
--
2.7.4
2.17.2

View File

@ -1,35 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 10 Oct 2018 11:15:30 -0500
Subject: [PATCH] libmultipath: timeout on unresponsive tur thread
If the tur checker thread has been cancelled but isn't responding,
timeout instead of doing a sync check. This will keep one bad
device from impacting all of multipathd.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/checkers/tur.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c
index 86c0cdc..b2a2170 100644
--- a/libmultipath/checkers/tur.c
+++ b/libmultipath/checkers/tur.c
@@ -305,10 +305,10 @@ int libcheck_check(struct checker * c)
} else {
if (uatomic_read(&ct->holders) > 1) {
/* The thread has been cancelled but hasn't
- * quilt. Fail back to synchronous mode */
- condlog(3, "%d:%d : tur checker failing back to sync",
+ * quit. exit with timeout. */
+ condlog(3, "%d:%d : tur thread not responding",
major(ct->devt), minor(ct->devt));
- return tur_check(c->fd, c->timeout, c->message);
+ return PATH_TIMEOUT;
}
/* Start new TUR checker */
pthread_mutex_lock(&ct->lock);
--
2.7.4

View File

@ -49,5 +49,5 @@ index b86cba6..70accd7 100644
CFLAGS := $(OPTFLAGS) -DBIN_DIR=\"$(bindir)\" -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" \
-MMD -MP $(CFLAGS)
--
2.7.4
2.17.2

View File

@ -14,17 +14,17 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/config.c | 2 +
multipath/Makefile | 5 +
multipath/mpathconf | 464 ++++++++++++++++++++++++++++++++++++++++++++++++++
multipath/mpathconf.8 | 119 +++++++++++++
multipath/mpathconf | 464 ++++++++++++++++++++++++++++++++++++++++++
multipath/mpathconf.8 | 119 +++++++++++
4 files changed, 590 insertions(+)
create mode 100644 multipath/mpathconf
create mode 100644 multipath/mpathconf.8
diff --git a/libmultipath/config.c b/libmultipath/config.c
index 6a9340a..bfd07e3 100644
index 2a9c668..654f330 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -748,6 +748,8 @@ load_config (char * file)
@@ -746,6 +746,8 @@ load_config (char * file)
factorize_hwtable(conf->hwtable, builtin_hwtable_size, file);
} else {
condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
@ -663,5 +663,5 @@ index 0000000..5b7ae0c
+.SH AUTHOR
+Benjamin Marzinski <bmarzins@redhat.com>
--
2.7.4
2.17.2

View File

@ -14,12 +14,12 @@ multipathd.service
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/wwids.c | 44 +++++++++++++++++++++++++++++++++++++++++++
libmultipath/wwids.c | 44 +++++++++++++++++++++++++++++++++++
libmultipath/wwids.h | 1 +
multipath/main.c | 10 ++++++++--
multipath/multipath.8 | 5 ++++-
multipath/main.c | 10 ++++++--
multipath/multipath.8 | 7 +++++-
multipathd/multipathd.service | 1 +
5 files changed, 58 insertions(+), 3 deletions(-)
5 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/libmultipath/wwids.c b/libmultipath/wwids.c
index 53e7951..39e08cd 100644
@ -86,7 +86,7 @@ index 0c6ee54..e32a0b0 100644
enum {
WWID_IS_NOT_FAILED = 0,
diff --git a/multipath/main.c b/multipath/main.c
index ffa5b22..ccb6091 100644
index 856202a..2c4054d 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -120,7 +120,7 @@ usage (char * progname)
@ -128,28 +128,30 @@ index ffa5b22..ccb6091 100644
usage(argv[0]);
exit(0);
diff --git a/multipath/multipath.8 b/multipath/multipath.8
index b5e5292..5bd5229 100644
index 9cdd05a..8befc45 100644
--- a/multipath/multipath.8
+++ b/multipath/multipath.8
@@ -25,7 +25,7 @@ multipath \- Device mapper target autoconfig.
.RB [\| \-b\ \c
.IR bindings_file \|]
.RB [\| \-d \|]
-.RB [\| \-h | \-l | \-ll | \-f | \-t | \-T | \-F | \-B | \-c | \-C | \-q | \-r | \-i | \-a | \-u | \-U | \-w | \-W \|]
+.RB [\| \-h | \-l | \-ll | \-f | \-t | \-T | \-F | \-B | \-c | \-C | \-q | \-r | \-i | \-a | \-A | \-u | \-U | \-w | \-W \|]
.RB [\| \-p\ \c
.IR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
.RB [\| \-R\ \c
@@ -141,6 +141,9 @@ Add the WWID for the specified device to the WWIDs file.
Check if the device specified in the program environment should be
a path in a multipath device.
@@ -63,7 +63,7 @@ multipath \- Device mapper target autoconfig.
.B multipath
.RB [\| \-v\ \c
.IR level \|]
-.B -W
+.RB [\| \-A | \-W \|]
.
.LP
.B multipath
@@ -145,6 +145,11 @@ device mapper, path checkers ...).
Add the WWID for the specified device to the WWIDs file.
.
+.B \-A
+add wwids from any kernel command line mpath.wwid parameters to the wwids file
+.
.TP
.B \-U
Check if the device specified in the program environment is a multipath device
+.B \-A
+Add the WWIDs from any kernel command line \fImpath.wwid\fR parameters to the
+WWIDs file.
+.
+.TP
.B \-w
Remove the WWID for the specified device from the WWIDs file.
.
diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service
index 17434ce..0fbcc46 100644
--- a/multipathd/multipathd.service
@ -163,5 +165,5 @@ index 17434ce..0fbcc46 100644
ExecReload=/sbin/multipathd reconfigure
TasksMax=infinity
--
2.7.4
2.17.2

View File

@ -16,13 +16,14 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index bf4701e..9d63d26 100644
index a81c051..fbef142 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -58,6 +58,21 @@ set_str(vector strvec, void *ptr)
return 0;
}
static int
+static int
+set_regex(vector strvec, void *ptr)
+{
+ char **str_ptr = (char **)ptr;
@ -37,11 +38,10 @@ index bf4701e..9d63d26 100644
+ return 0;
+}
+
+static int
static int
set_yes_no(vector strvec, void *ptr)
{
char * buff;
@@ -1336,7 +1351,7 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \
@@ -1347,7 +1362,7 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \
if (!conf->option) \
return 1; \
\
@ -50,7 +50,7 @@ index bf4701e..9d63d26 100644
if (!buff) \
return 1; \
\
@@ -1352,7 +1367,7 @@ ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec) \
@@ -1363,7 +1378,7 @@ ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec) \
if (!conf->option) \
return 1; \
\
@ -59,7 +59,7 @@ index bf4701e..9d63d26 100644
if (!buff) \
return 1; \
\
@@ -1455,16 +1470,16 @@ device_handler(struct config *conf, vector strvec)
@@ -1466,16 +1481,16 @@ device_handler(struct config *conf, vector strvec)
return 0;
}
@ -117,5 +117,5 @@ index 62906e9..b791705 100644
extern struct keyword * find_keyword(vector keywords, vector v, char * name);
int snprint_keyword(char *buff, int len, char *fmt, struct keyword *kw,
--
2.7.4
2.17.2

View File

@ -12,7 +12,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index 7f3839f..c84d31d 100644
index 6576939..2ad6308 100644
--- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h
@@ -17,7 +17,7 @@
@ -25,5 +25,5 @@ index 7f3839f..c84d31d 100644
#define DEFAULT_DEV_LOSS_TMO 600
#define DEFAULT_RETAIN_HWHANDLER RETAIN_HWHANDLER_ON
--
2.7.4
2.17.2

View File

@ -1,5 +1,5 @@
Name: device-mapper-multipath
Version: 0.7.8
Version: 0.7.9
Release: 1%{?dist}
Summary: Tools to manage multipath devices using device-mapper
License: GPLv2
@ -7,23 +7,20 @@ URL: http://christophe.varoqui.free.fr/
# The source for this package was pulled from upstream's git repo. Use the
# following command to generate the tarball
# curl "https://git.opensvc.com/?p=multipath-tools/.git;a=snapshot;h=refs/tags/0.7.8;sf=tgz" -o multipath-tools-0.7.8.tgz
Source0: multipath-tools-0.7.8.tgz
# curl "https://git.opensvc.com/?p=multipath-tools/.git;a=snapshot;h=refs/tags/0.7.9;sf=tgz" -o multipath-tools-0.7.9.tgz
Source0: multipath-tools-0.7.9.tgz
Source1: multipath.conf
Patch0001: 0001-multipath-tweak-logging-style.patch
Patch0002: 0002-multipathd-check-for-NULL-udevice-in-cli_add_path.patch
Patch0003: 0003-libmultipath-remove-max_fds-code-duplication.patch
Patch0004: 0004-multipathd-set-return-code-for-multipathd-commands.patch
Patch0005: 0005-mpathpersist-fix-registration-rollback-issue.patch
Patch0006: 0006-libmultipath-timeout-on-unresponsive-tur-thread.patch
Patch0007: 0007-RH-fixup-udev-rules-for-redhat.patch
Patch0008: 0008-RH-Remove-the-property-blacklist-exception-builtin.patch
Patch0009: 0009-RH-don-t-start-without-a-config-file.patch
Patch0010: 0010-RH-use-rpm-optflags-if-present.patch
Patch0011: 0011-RH-add-mpathconf.patch
Patch0012: 0012-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
Patch0013: 0013-RH-warn-on-invalid-regex-instead-of-failing.patch
Patch0014: 0014-RH-reset-default-find_mutipaths-value-to-off.patch
Patch0001: 0001-multipathd-fix-mpp-hwe-handling-when-paths-are-freed.patch
Patch0002: 0002-libmultipath-cleanup-pthread_cleanup_pop-call.patch
Patch0003: 0003-libmultipath-fix-false-removes-in-dmevents-polling-c.patch
Patch0004: 0004-RH-fixup-udev-rules-for-redhat.patch
Patch0005: 0005-RH-Remove-the-property-blacklist-exception-builtin.patch
Patch0006: 0006-RH-don-t-start-without-a-config-file.patch
Patch0007: 0007-RH-use-rpm-optflags-if-present.patch
Patch0008: 0008-RH-add-mpathconf.patch
Patch0009: 0009-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
Patch0010: 0010-RH-warn-on-invalid-regex-instead-of-failing.patch
Patch0011: 0011-RH-reset-default-find_mutipaths-value-to-off.patch
# runtime
Requires: %{name}-libs = %{version}-%{release}
@ -106,7 +103,7 @@ This package contains the files needed to develop applications that use
device-mapper-multipath's libdmmp C API library
%prep
%setup -q -n multipath-tools-0.7.8
%setup -q -n multipath-tools-0.7.9
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
@ -118,9 +115,6 @@ device-mapper-multipath's libdmmp C API library
%patch0009 -p1
%patch0010 -p1
%patch0011 -p1
%patch0012 -p1
%patch0013 -p1
%patch0014 -p1
cp %{SOURCE1} .
%build
@ -236,6 +230,16 @@ fi
%{_pkgconfdir}/libdmmp.pc
%changelog
* Mon Dec 3 2018 Benjamin Marzinski <bmarzins@redhat.com> 0.7.9-1
- Update Source to upstream version 0.7.9
* Previous patches 0001-0006 are included in this version
- Rename files
* Previous patches 0007-0014 are now patches 0004-0011
- Add 0001-multipathd-fix-mpp-hwe-handling-when-paths-are-freed.patch
- Add 0002-libmultipath-cleanup-pthread_cleanup_pop-call.patch
- Add 0003-libmultipath-fix-false-removes-in-dmevents-polling-c.patch
* The above 3 patches have been submitted upstream
* Wed Oct 10 2018 Benjamin Marzinski <bmarzins@redhat.com> 0.7.8-1
- Update Source to upstream version 0.7.8
* Previous patches 0001-0020 are included in this version

View File

@ -1,2 +1,2 @@
SHA512 (multipath-tools-0.7.8.tgz) = 43f111b4c27e8d5a79a716751c53fe9071a557f9e6669283c55d2cc8dfdc7e1e67dd48c765a408b96f87c73f911e2ff519dad96422d29f7b8fd37ee3fe4416b4
SHA512 (multipath-tools-0.7.9.tgz) = 3595bb11ed7a52727308ba50b860a63e13c7640ed0c7289a460bcbd44c3a1b5e58c4619f22de4f212fb87498363186f0bccbcf8deb88e8ac9f1f217c414e93ec
SHA512 (multipath.conf) = 71953dce5a68adcf60a942305f5a66023e6f4c4baf53b1bfdb4edf65ed5b8e03db804363c36d1dcfd85591f4766f52b515269904c53b84d7b076da0b80b09942