import device-mapper-multipath-0.8.4-2.el8
This commit is contained in:
parent
6ef0bbb6c3
commit
67f1445a6b
@ -1 +1 @@
|
||||
f700dc1e4ce1d6952051467d4b245f9bd80286e3 SOURCES/multipath-tools-0.8.3.tgz
|
||||
b52c2be340449664f0a122070838f6d8edd42e4a SOURCES/multipath-tools-0.8.4.tgz
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
SOURCES/multipath-tools-0.8.3.tgz
|
||||
SOURCES/multipath-tools-0.8.4.tgz
|
||||
|
@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Tue, 17 Mar 2020 17:28:24 -0500
|
||||
Subject: [PATCH] libmultipath: assign variable to make gcc happy
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
There is nothing wrong with is_queueing not being set at the start
|
||||
of __set_no_path_retry(), it will always get set before it is accessed,
|
||||
but gcc 8.2.1 is failing with
|
||||
|
||||
structs_vec.c: In function ‘__set_no_path_retry’:
|
||||
structs_vec.c:339:7: error: ‘is_queueing’ may be used uninitialized in
|
||||
this function [-Werror=maybe-uninitialized]
|
||||
bool is_queueing;
|
||||
^~~~~~~~~~~
|
||||
|
||||
so, assign a value to make it happy.
|
||||
|
||||
Reviewed-by: Martin Wilck <mwilck@suse.com>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/structs_vec.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
|
||||
index 3dbbaa0f..077f2e42 100644
|
||||
--- a/libmultipath/structs_vec.c
|
||||
+++ b/libmultipath/structs_vec.c
|
||||
@@ -336,7 +336,7 @@ static void leave_recovery_mode(struct multipath *mpp)
|
||||
|
||||
void __set_no_path_retry(struct multipath *mpp, bool check_features)
|
||||
{
|
||||
- bool is_queueing;
|
||||
+ bool is_queueing = false; /* assign a value to make gcc happy */
|
||||
|
||||
check_features = check_features && mpp->features != NULL;
|
||||
if (check_features)
|
||||
--
|
||||
2.17.2
|
||||
|
@ -1,277 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Thu, 19 Sep 2019 13:46:03 -0500
|
||||
Subject: [PATCH] multipathd: warn when configuration has been changed.
|
||||
|
||||
It would be helpful if multipathd could log a message when
|
||||
multipath.conf or files in the config_dir have been written to, both so
|
||||
that it can be used to send a notification to users, and to help with
|
||||
determining after the fact if multipathd was running with an older
|
||||
config, when the logs of multipathd's behaviour don't match with the
|
||||
current multipath.conf.
|
||||
|
||||
To do this, the multipathd uxlsnr thread now sets up inotify watches on
|
||||
both /etc/multipath.conf and the config_dir to watch if the files are
|
||||
deleted or closed after being opened for writing. In order to keep
|
||||
uxlsnr from polling repeatedly if the multipath.conf or the config_dir
|
||||
aren't present, it will only set up the watches once per reconfigure.
|
||||
However, since multipath.conf is far more likely to be replaced by a
|
||||
text editor than modified in place, if it gets removed, multipathd will
|
||||
immediately try to restart the watch on it (which will succeed if the
|
||||
file was simply replaced by a new copy). This does mean that if
|
||||
multipath.conf or the config_dir are actually removed and then later
|
||||
re-added, multipathd won't log any more messages for changes until the
|
||||
next reconfigure. But that seems like a fair trade-off to avoid
|
||||
repeatedly polling for files that aren't likely to appear.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/config.h | 1 +
|
||||
multipathd/main.c | 1 +
|
||||
multipathd/uxlsnr.c | 134 ++++++++++++++++++++++++++++++++++++++++--
|
||||
3 files changed, 130 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/config.h b/libmultipath/config.h
|
||||
index ffec3103..e69aa07c 100644
|
||||
--- a/libmultipath/config.h
|
||||
+++ b/libmultipath/config.h
|
||||
@@ -188,6 +188,7 @@ struct config {
|
||||
int find_multipaths_timeout;
|
||||
int marginal_pathgroups;
|
||||
unsigned int version[3];
|
||||
+ unsigned int sequence_nr;
|
||||
|
||||
char * multipath_dir;
|
||||
char * selector;
|
||||
diff --git a/multipathd/main.c b/multipathd/main.c
|
||||
index 34a57689..7b364cfe 100644
|
||||
--- a/multipathd/main.c
|
||||
+++ b/multipathd/main.c
|
||||
@@ -2618,6 +2618,7 @@ reconfigure (struct vectors * vecs)
|
||||
uxsock_timeout = conf->uxsock_timeout;
|
||||
|
||||
old = rcu_dereference(multipath_conf);
|
||||
+ conf->sequence_nr = old->sequence_nr + 1;
|
||||
rcu_assign_pointer(multipath_conf, conf);
|
||||
call_rcu(&old->rcu, rcu_free_config);
|
||||
|
||||
diff --git a/multipathd/uxlsnr.c b/multipathd/uxlsnr.c
|
||||
index bc71679e..92d9a79a 100644
|
||||
--- a/multipathd/uxlsnr.c
|
||||
+++ b/multipathd/uxlsnr.c
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
+#include <sys/inotify.h>
|
||||
#include "checkers.h"
|
||||
#include "memory.h"
|
||||
#include "debug.h"
|
||||
@@ -51,6 +52,8 @@ struct client {
|
||||
LIST_HEAD(clients);
|
||||
pthread_mutex_t client_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
struct pollfd *polls;
|
||||
+int notify_fd = -1;
|
||||
+char *config_dir;
|
||||
|
||||
static bool _socket_client_is_root(int fd);
|
||||
|
||||
@@ -151,6 +154,8 @@ void uxsock_cleanup(void *arg)
|
||||
long ux_sock = (long)arg;
|
||||
|
||||
close(ux_sock);
|
||||
+ close(notify_fd);
|
||||
+ free(config_dir);
|
||||
|
||||
pthread_mutex_lock(&client_lock);
|
||||
list_for_each_entry_safe(client_loop, client_tmp, &clients, node) {
|
||||
@@ -162,6 +167,106 @@ void uxsock_cleanup(void *arg)
|
||||
free_polls();
|
||||
}
|
||||
|
||||
+/* failing to set the watch descriptor is o.k. we just miss a warning
|
||||
+ * message */
|
||||
+void reset_watch(int notify_fd, int *wds, unsigned int *sequence_nr)
|
||||
+{
|
||||
+ struct config *conf;
|
||||
+ int dir_reset = 0;
|
||||
+ int conf_reset = 0;
|
||||
+
|
||||
+ if (notify_fd == -1)
|
||||
+ return;
|
||||
+
|
||||
+ conf = get_multipath_config();
|
||||
+ /* instead of repeatedly try to reset the inotify watch if
|
||||
+ * the config directory or multipath.conf isn't there, just
|
||||
+ * do it once per reconfigure */
|
||||
+ if (*sequence_nr != conf->sequence_nr) {
|
||||
+ *sequence_nr = conf->sequence_nr;
|
||||
+ if (wds[0] == -1)
|
||||
+ conf_reset = 1;
|
||||
+ if (!config_dir || !conf->config_dir ||
|
||||
+ strcmp(config_dir, conf->config_dir)) {
|
||||
+ dir_reset = 1;
|
||||
+ if (config_dir)
|
||||
+ free(config_dir);
|
||||
+ if (conf->config_dir)
|
||||
+ config_dir = strdup(conf->config_dir);
|
||||
+ else
|
||||
+ config_dir = NULL;
|
||||
+ } else if (wds[1] == -1)
|
||||
+ dir_reset = 1;
|
||||
+ }
|
||||
+ put_multipath_config(conf);
|
||||
+
|
||||
+ if (dir_reset) {
|
||||
+ if (wds[1] != -1) {
|
||||
+ inotify_rm_watch(notify_fd, wds[1]);
|
||||
+ wds[1] = -1;
|
||||
+ }
|
||||
+ if (config_dir) {
|
||||
+ wds[1] = inotify_add_watch(notify_fd, config_dir,
|
||||
+ IN_CLOSE_WRITE | IN_DELETE |
|
||||
+ IN_ONLYDIR);
|
||||
+ if (wds[1] == -1)
|
||||
+ condlog(3, "didn't set up notifications on %s: %s", config_dir, strerror(errno));
|
||||
+ }
|
||||
+ }
|
||||
+ if (conf_reset) {
|
||||
+ wds[0] = inotify_add_watch(notify_fd, DEFAULT_CONFIGFILE,
|
||||
+ IN_CLOSE_WRITE);
|
||||
+ if (wds[0] == -1)
|
||||
+ condlog(3, "didn't set up notifications on /etc/multipath.conf: %s", strerror(errno));
|
||||
+ }
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+void handle_inotify(int fd, int *wds)
|
||||
+{
|
||||
+ char buff[1024]
|
||||
+ __attribute__ ((aligned(__alignof__(struct inotify_event))));
|
||||
+ const struct inotify_event *event;
|
||||
+ ssize_t len;
|
||||
+ char *ptr;
|
||||
+ int i, got_notify = 0;
|
||||
+
|
||||
+ for (;;) {
|
||||
+ len = read(fd, buff, sizeof(buff));
|
||||
+ if (len <= 0) {
|
||||
+ if (len < 0 && errno != EAGAIN) {
|
||||
+ condlog(3, "error reading from inotify_fd");
|
||||
+ for (i = 0; i < 2; i++) {
|
||||
+ if (wds[i] != -1) {
|
||||
+ inotify_rm_watch(fd, wds[i]);
|
||||
+ wds[i] = -1;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ got_notify = 1;
|
||||
+ for (ptr = buff; ptr < buff + len;
|
||||
+ ptr += sizeof(struct inotify_event) + event->len) {
|
||||
+ event = (const struct inotify_event *) ptr;
|
||||
+
|
||||
+ if (event->mask & IN_IGNORED) {
|
||||
+ /* multipathd.conf may have been overwritten.
|
||||
+ * Try once to reset the notification */
|
||||
+ if (wds[0] == event->wd)
|
||||
+ wds[0] = inotify_add_watch(notify_fd,
|
||||
+ DEFAULT_CONFIGFILE,
|
||||
+ IN_CLOSE_WRITE);
|
||||
+ else if (wds[1] == event->wd)
|
||||
+ wds[1] = -1;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (got_notify)
|
||||
+ condlog(1, "Multipath configuration updated.\nReload multipathd for changes to take effect");
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* entry point
|
||||
*/
|
||||
@@ -173,13 +278,19 @@ void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, long ux_sock,
|
||||
char *reply;
|
||||
sigset_t mask;
|
||||
int old_clients = MIN_POLLS;
|
||||
+ /* conf->sequence_nr will be 1 when uxsock_listen is first called */
|
||||
+ unsigned int sequence_nr = 0;
|
||||
+ int wds[2] = { -1, -1 };
|
||||
|
||||
condlog(3, "uxsock: startup listener");
|
||||
- polls = (struct pollfd *)MALLOC((MIN_POLLS + 1) * sizeof(struct pollfd));
|
||||
+ polls = (struct pollfd *)MALLOC((MIN_POLLS + 2) * sizeof(struct pollfd));
|
||||
if (!polls) {
|
||||
condlog(0, "uxsock: failed to allocate poll fds");
|
||||
exit_daemon();
|
||||
}
|
||||
+ notify_fd = inotify_init1(IN_NONBLOCK);
|
||||
+ if (notify_fd == -1) /* it's fine if notifications fail */
|
||||
+ condlog(3, "failed to start up configuration notifications");
|
||||
sigfillset(&mask);
|
||||
sigdelset(&mask, SIGINT);
|
||||
sigdelset(&mask, SIGTERM);
|
||||
@@ -198,18 +309,18 @@ void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, long ux_sock,
|
||||
if (num_clients != old_clients) {
|
||||
struct pollfd *new;
|
||||
if (num_clients <= MIN_POLLS && old_clients > MIN_POLLS) {
|
||||
- new = REALLOC(polls, (1 + MIN_POLLS) *
|
||||
+ new = REALLOC(polls, (2 + MIN_POLLS) *
|
||||
sizeof(struct pollfd));
|
||||
} else if (num_clients <= MIN_POLLS && old_clients <= MIN_POLLS) {
|
||||
new = polls;
|
||||
} else {
|
||||
- new = REALLOC(polls, (1+num_clients) *
|
||||
+ new = REALLOC(polls, (2 + num_clients) *
|
||||
sizeof(struct pollfd));
|
||||
}
|
||||
if (!new) {
|
||||
pthread_mutex_unlock(&client_lock);
|
||||
condlog(0, "%s: failed to realloc %d poll fds",
|
||||
- "uxsock", 1 + num_clients);
|
||||
+ "uxsock", 2 + num_clients);
|
||||
sched_yield();
|
||||
continue;
|
||||
}
|
||||
@@ -219,8 +330,15 @@ void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, long ux_sock,
|
||||
polls[0].fd = ux_sock;
|
||||
polls[0].events = POLLIN;
|
||||
|
||||
+ reset_watch(notify_fd, wds, &sequence_nr);
|
||||
+ if (notify_fd == -1 || (wds[0] == -1 && wds[1] == -1))
|
||||
+ polls[1].fd = -1;
|
||||
+ else
|
||||
+ polls[1].fd = notify_fd;
|
||||
+ polls[1].events = POLLIN;
|
||||
+
|
||||
/* setup the clients */
|
||||
- i = 1;
|
||||
+ i = 2;
|
||||
list_for_each_entry(c, &clients, node) {
|
||||
polls[i].fd = c->fd;
|
||||
polls[i].events = POLLIN;
|
||||
@@ -262,7 +380,7 @@ void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, long ux_sock,
|
||||
}
|
||||
|
||||
/* see if a client wants to speak to us */
|
||||
- for (i = 1; i < num_clients + 1; i++) {
|
||||
+ for (i = 2; i < num_clients + 2; i++) {
|
||||
if (polls[i].revents & POLLIN) {
|
||||
struct timespec start_time;
|
||||
|
||||
@@ -321,6 +439,10 @@ void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, long ux_sock,
|
||||
if (polls[0].revents & POLLIN) {
|
||||
new_client(ux_sock);
|
||||
}
|
||||
+
|
||||
+ /* handle inotify events on config files */
|
||||
+ if (polls[1].revents & POLLIN)
|
||||
+ handle_inotify(notify_fd, wds);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
--
|
||||
2.17.2
|
||||
|
@ -1,59 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Mon, 7 Oct 2019 17:17:13 -0500
|
||||
Subject: [PATCH] libmultipath: fix leak in foreign code
|
||||
|
||||
If scandir fails or finds no foreign libraries, enable_re needs to be
|
||||
freed before exitting.
|
||||
|
||||
Fixes: 8d03eda4 'multipath.conf: add "enable_foreign" parameter'
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/foreign.c | 11 +++++++----
|
||||
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/foreign.c b/libmultipath/foreign.c
|
||||
index 4b34e141..68e9a9b8 100644
|
||||
--- a/libmultipath/foreign.c
|
||||
+++ b/libmultipath/foreign.c
|
||||
@@ -129,7 +129,7 @@ static int _init_foreign(const char *multipath_dir, const char *enable)
|
||||
char pathbuf[PATH_MAX];
|
||||
struct dirent **di;
|
||||
struct scandir_result sr;
|
||||
- int r, i;
|
||||
+ int r, i, ret = 0;
|
||||
regex_t *enable_re = NULL;
|
||||
|
||||
foreigns = vector_alloc();
|
||||
@@ -157,13 +157,15 @@ static int _init_foreign(const char *multipath_dir, const char *enable)
|
||||
if (r == 0) {
|
||||
condlog(3, "%s: no foreign multipath libraries found",
|
||||
__func__);
|
||||
- return 0;
|
||||
+ ret = 0;
|
||||
+ goto out;
|
||||
} else if (r < 0) {
|
||||
r = errno;
|
||||
condlog(1, "%s: error %d scanning foreign multipath libraries",
|
||||
__func__, r);
|
||||
_cleanup_foreign();
|
||||
- return -r;
|
||||
+ ret = -r;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
sr.di = di;
|
||||
@@ -250,8 +252,9 @@ static int _init_foreign(const char *multipath_dir, const char *enable)
|
||||
free_foreign(fgn);
|
||||
}
|
||||
pthread_cleanup_pop(1); /* free_scandir_result */
|
||||
+out:
|
||||
pthread_cleanup_pop(1); /* free_pre */
|
||||
- return 0;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
int init_foreign(const char *multipath_dir, const char *enable)
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Sat, 21 Mar 2020 23:49:59 -0500
|
||||
Subject: [PATCH] libmutipath: don't close fd on dm_lib_release
|
||||
|
||||
If dm_hold_control_open() isn't set, when dm_lib_release() is called, it
|
||||
will close the control fd. The control fd will get re-opened on the next
|
||||
dm_task_run() call, but if there is a dm_task_run() call already
|
||||
in progress in another thread, it can fail. Since many of the
|
||||
device-mapper callouts happen with the vecs lock held, this wasn't too
|
||||
noticeable, but there is code that calls dm_task_run() without the
|
||||
vecs lock held, notably the dmevent waiter code.
|
||||
|
||||
Since, as Martin pointed out, dm_hold_control_open() hasn't always
|
||||
existed in libdevmapper, check if it's supported on compilation,
|
||||
and update the version requirements if so.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/Makefile | 4 ++++
|
||||
libmultipath/devmapper.c | 7 ++++++-
|
||||
2 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
|
||||
index e5651e49..ad690a49 100644
|
||||
--- a/libmultipath/Makefile
|
||||
+++ b/libmultipath/Makefile
|
||||
@@ -36,6 +36,10 @@ ifneq ($(call check_func,dm_task_deferred_remove,/usr/include/libdevmapper.h),0)
|
||||
CFLAGS += -DLIBDM_API_DEFERRED
|
||||
endif
|
||||
|
||||
+ifneq ($(call check_func,dm_hold_control_dev,/usr/include/libdevmapper.h),0)
|
||||
+ CFLAGS += -DLIBDM_API_HOLD_CONTROL
|
||||
+endif
|
||||
+
|
||||
OBJS = memory.o parser.o vector.o devmapper.o callout.o \
|
||||
hwtable.o blacklist.o util.o dmparser.o config.o \
|
||||
structs.o discovery.o propsel.o dict.o \
|
||||
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
|
||||
index bed8ddc6..13a1cf53 100644
|
||||
--- a/libmultipath/devmapper.c
|
||||
+++ b/libmultipath/devmapper.c
|
||||
@@ -108,7 +108,9 @@ dm_lib_prereq (void)
|
||||
{
|
||||
char version[64];
|
||||
int v[3];
|
||||
-#if defined(LIBDM_API_DEFERRED)
|
||||
+#if defined(LIBDM_API_HOLD_CONTROL)
|
||||
+ int minv[3] = {1, 2, 111};
|
||||
+#elif defined(LIBDM_API_DEFERRED)
|
||||
int minv[3] = {1, 2, 89};
|
||||
#elif defined(DM_SUBSYSTEM_UDEV_FLAG0)
|
||||
int minv[3] = {1, 2, 82};
|
||||
@@ -254,6 +256,9 @@ void libmp_dm_init(void)
|
||||
memcpy(conf->version, version, sizeof(version));
|
||||
put_multipath_config(conf);
|
||||
dm_init(verbosity);
|
||||
+#ifdef LIBDM_API_HOLD_CONTROL
|
||||
+ dm_hold_control_dev(1);
|
||||
+#endif
|
||||
dm_udev_set_sync_support(libmp_dm_udev_sync);
|
||||
}
|
||||
|
||||
--
|
||||
2.17.2
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Tue, 8 Oct 2019 10:17:11 -0500
|
||||
Subject: [PATCH] Fix leak in mpathpersist
|
||||
|
||||
If the persistent in command fails, the response buffer must be freed.
|
||||
Found by Coverity
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
mpathpersist/main.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/mpathpersist/main.c b/mpathpersist/main.c
|
||||
index 278b8d51..920e686c 100644
|
||||
--- a/mpathpersist/main.c
|
||||
+++ b/mpathpersist/main.c
|
||||
@@ -499,6 +499,7 @@ static int handle_args(int argc, char * argv[], int nline)
|
||||
if (ret != MPATH_PR_SUCCESS )
|
||||
{
|
||||
fprintf (stderr, "Persistent Reserve IN command failed\n");
|
||||
+ free(resp);
|
||||
goto out_fd;
|
||||
}
|
||||
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,64 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Thu, 19 Mar 2020 22:17:51 -0500
|
||||
Subject: [PATCH] libmultipath: allow force reload with no active paths
|
||||
|
||||
If the partition information has changed on multipath devices (say,
|
||||
because it was updated on another node that has access to the same
|
||||
storage), users expect that running "multipathd reconfigure" will update
|
||||
that. However, if the checkers for the multipath device are pending for
|
||||
too long when the the device is reconfigured, multipathd will give up
|
||||
waiting for them, and refuse to reload the device, since there are no
|
||||
active paths. This means that no kpartx update will be triggered.
|
||||
|
||||
Multipath is fully capable of reloading a multipath device that has no
|
||||
active paths. This has been possible for years. If multipath is supposed
|
||||
to reload the device, it should do so, even if there are no active paths.
|
||||
|
||||
Generally, when multipath is force reloaded, kpartx will be updated.
|
||||
However when a device is reloaded with no paths, the udev rules won't
|
||||
run kpartx. But they also weren't running kpartx when the first valid
|
||||
path appeared, even though the dm activation rules get run in this case.
|
||||
This changes 11-dm-mpath.rules to run kpartx when a device goes from no
|
||||
usable paths to having usable paths.
|
||||
|
||||
Reviewed-by: Martin Wilck <mwilck@suse.com>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/configure.c | 6 ------
|
||||
multipath/11-dm-mpath.rules | 2 +-
|
||||
2 files changed, 1 insertion(+), 7 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
|
||||
index c95848a0..96c79610 100644
|
||||
--- a/libmultipath/configure.c
|
||||
+++ b/libmultipath/configure.c
|
||||
@@ -710,12 +710,6 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
|
||||
return;
|
||||
}
|
||||
|
||||
- if (pathcount(mpp, PATH_UP) == 0) {
|
||||
- mpp->action = ACT_IMPOSSIBLE;
|
||||
- condlog(3, "%s: set ACT_IMPOSSIBLE (no usable path)",
|
||||
- mpp->alias);
|
||||
- return;
|
||||
- }
|
||||
if (force_reload) {
|
||||
mpp->force_udev_reload = 1;
|
||||
mpp->action = ACT_RELOAD;
|
||||
diff --git a/multipath/11-dm-mpath.rules b/multipath/11-dm-mpath.rules
|
||||
index 07320a14..cd522e8c 100644
|
||||
--- a/multipath/11-dm-mpath.rules
|
||||
+++ b/multipath/11-dm-mpath.rules
|
||||
@@ -75,7 +75,7 @@ ENV{MPATH_DEVICE_READY}=="0", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
|
||||
ENV{MPATH_DEVICE_READY}!="0", ENV{.MPATH_DEVICE_READY_OLD}=="0",\
|
||||
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="$env{DM_DISABLE_OTHER_RULES_FLAG_OLD}",\
|
||||
ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="",\
|
||||
- ENV{DM_ACTIVATION}="1"
|
||||
+ ENV{DM_ACTIVATION}="1", ENV{MPATH_UNCHANGED}="0"
|
||||
|
||||
# The code to check multipath state ends here. We need to set
|
||||
# properties and symlinks regardless whether the map is usable or
|
||||
--
|
||||
2.17.2
|
||||
|
31
SOURCES/0004-libmpathpersist-depend-on-libmultipath.patch
Normal file
31
SOURCES/0004-libmpathpersist-depend-on-libmultipath.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Hesse <mail@eworm.de>
|
||||
Date: Wed, 6 May 2020 09:35:47 +0200
|
||||
Subject: [PATCH] libmpathpersist: depend on libmultipath
|
||||
|
||||
Without this the build fails with:
|
||||
|
||||
/usr/bin/ld: cannot find -lmultipath
|
||||
|
||||
Signed-off-by: Christian Hesse <mail@eworm.de>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 1dee3680..ba1d73ba 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -28,7 +28,7 @@ all: $(BUILDDIRS)
|
||||
$(BUILDDIRS):
|
||||
$(MAKE) -C $@
|
||||
|
||||
-multipath multipathd mpathpersist: libmultipath
|
||||
+libmpathpersist multipath multipathd mpathpersist: libmultipath
|
||||
mpathpersist: libmpathpersist
|
||||
|
||||
$(BUILDDIRS.clean):
|
||||
--
|
||||
2.17.2
|
||||
|
@ -1,25 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Tue, 5 Nov 2019 13:53:29 -0600
|
||||
Subject: [PATCH] libmultipath: remove unused path->prio_args
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/structs.h | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
|
||||
index a3adf906..1c32a799 100644
|
||||
--- a/libmultipath/structs.h
|
||||
+++ b/libmultipath/structs.h
|
||||
@@ -272,7 +272,6 @@ struct path {
|
||||
char * uid_attribute;
|
||||
char * getuid;
|
||||
struct prio prio;
|
||||
- char * prio_args;
|
||||
struct checker checker;
|
||||
struct multipath * mpp;
|
||||
int fd;
|
||||
--
|
||||
2.17.2
|
||||
|
@ -1,34 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Wed, 6 Nov 2019 16:49:40 -0600
|
||||
Subject: [PATCH] libmultipath: constify get_unaligned_be*
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/unaligned.h | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/unaligned.h b/libmultipath/unaligned.h
|
||||
index 68c07742..b9eaa7cb 100644
|
||||
--- a/libmultipath/unaligned.h
|
||||
+++ b/libmultipath/unaligned.h
|
||||
@@ -10,14 +10,14 @@ static inline uint16_t get_unaligned_be16(const void *ptr)
|
||||
return p[0] << 8 | p[1];
|
||||
}
|
||||
|
||||
-static inline uint32_t get_unaligned_be32(void *ptr)
|
||||
+static inline uint32_t get_unaligned_be32(const void *ptr)
|
||||
{
|
||||
const uint8_t *p = ptr;
|
||||
|
||||
return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
|
||||
}
|
||||
|
||||
-static inline uint64_t get_unaligned_be64(void *ptr)
|
||||
+static inline uint64_t get_unaligned_be64(const void *ptr)
|
||||
{
|
||||
uint32_t low = get_unaligned_be32(ptr + 4);
|
||||
uint64_t high = get_unaligned_be32(ptr);
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Tue, 12 May 2020 00:39:21 +0200
|
||||
Subject: [PATCH] multipath-tools: Makefile: more dependency fixes for parallel
|
||||
build
|
||||
|
||||
Extend the late fixes from Christian.
|
||||
|
||||
Cc: Christian Hesse <mail@eworm.de>
|
||||
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
Makefile | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index ba1d73ba..fec3b73b 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -28,8 +28,9 @@ all: $(BUILDDIRS)
|
||||
$(BUILDDIRS):
|
||||
$(MAKE) -C $@
|
||||
|
||||
-libmpathpersist multipath multipathd mpathpersist: libmultipath
|
||||
-mpathpersist: libmpathpersist
|
||||
+libmultipath libdmmp: libmpathcmd
|
||||
+libmpathpersist multipath multipathd: libmultipath
|
||||
+mpathpersist multipathd: libmpathpersist
|
||||
|
||||
$(BUILDDIRS.clean):
|
||||
$(MAKE) -C ${@:.clean=} clean
|
||||
--
|
||||
2.17.2
|
||||
|
@ -1,49 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Tue, 5 Nov 2019 12:37:58 -0600
|
||||
Subject: [PATCH] libmultipath: add missing hwe mpe variable merges
|
||||
|
||||
There were some variables in the hwe and mpe structs that weren't being
|
||||
merged by merge_hwe() and merge_mpe().
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/config.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/libmultipath/config.c b/libmultipath/config.c
|
||||
index 20e3b8bf..85626e96 100644
|
||||
--- a/libmultipath/config.c
|
||||
+++ b/libmultipath/config.c
|
||||
@@ -372,6 +372,10 @@ merge_hwe (struct hwentry * dst, struct hwentry * src)
|
||||
merge_num(san_path_err_threshold);
|
||||
merge_num(san_path_err_forget_rate);
|
||||
merge_num(san_path_err_recovery_time);
|
||||
+ merge_num(marginal_path_err_sample_time);
|
||||
+ merge_num(marginal_path_err_rate_threshold);
|
||||
+ merge_num(marginal_path_err_recheck_gap_time);
|
||||
+ merge_num(marginal_path_double_failed_time);
|
||||
|
||||
snprintf(id, sizeof(id), "%s/%s", dst->vendor, dst->product);
|
||||
reconcile_features_with_options(id, &dst->features,
|
||||
@@ -397,6 +401,7 @@ merge_mpe(struct mpentry *dst, struct mpentry *src)
|
||||
if (dst->prkey_source == PRKEY_SOURCE_NONE &&
|
||||
src->prkey_source != PRKEY_SOURCE_NONE) {
|
||||
dst->prkey_source = src->prkey_source;
|
||||
+ dst->sa_flags = src->sa_flags;
|
||||
memcpy(&dst->reservation_key, &src->reservation_key,
|
||||
sizeof(dst->reservation_key));
|
||||
}
|
||||
@@ -413,6 +418,9 @@ merge_mpe(struct mpentry *dst, struct mpentry *src)
|
||||
merge_num(deferred_remove);
|
||||
merge_num(delay_watch_checks);
|
||||
merge_num(delay_wait_checks);
|
||||
+ merge_num(san_path_err_threshold);
|
||||
+ merge_num(san_path_err_forget_rate);
|
||||
+ merge_num(san_path_err_recovery_time);
|
||||
merge_num(marginal_path_err_sample_time);
|
||||
merge_num(marginal_path_err_rate_threshold);
|
||||
merge_num(marginal_path_err_recheck_gap_time);
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Tue, 12 May 2020 00:39:24 +0200
|
||||
Subject: [PATCH] multipath-tools: Makefile.inc: set -Wno-error=clobbered
|
||||
|
||||
We need to ignore -Wclobbered because gcc has trouble dealing with glibc's
|
||||
implementation of pthread_cleanup_push().
|
||||
|
||||
For some variants of gcc, -Wno-clobbered alone isn't enough if -Werror is also
|
||||
set. Compilation with -Wno-error=clobbered works, though.
|
||||
|
||||
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
Makefile.inc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.inc b/Makefile.inc
|
||||
index d4d1e0dd..9060ac9b 100644
|
||||
--- a/Makefile.inc
|
||||
+++ b/Makefile.inc
|
||||
@@ -91,7 +91,7 @@ TEST_CC_OPTION = $(shell \
|
||||
|
||||
STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)
|
||||
ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers,)
|
||||
-WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered,)
|
||||
+WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)
|
||||
|
||||
OPTFLAGS = -O2 -g -pipe -Werror -Wall -Wextra -Wformat=2 -Werror=implicit-int \
|
||||
-Werror=implicit-function-declaration -Werror=format-security \
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,91 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Tue, 12 May 2020 00:39:25 +0200
|
||||
Subject: [PATCH] libmultipath: discovery.c: use %z qualifier for size_t
|
||||
|
||||
Otherwise compilation for 32bit targets spits out warnings.
|
||||
|
||||
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/discovery.c | 16 ++++++++--------
|
||||
1 file changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
|
||||
index ee3290cd..ffec5162 100644
|
||||
--- a/libmultipath/discovery.c
|
||||
+++ b/libmultipath/discovery.c
|
||||
@@ -986,7 +986,7 @@ parse_vpd_pg80(const unsigned char *in, char *out, size_t out_len)
|
||||
}
|
||||
|
||||
if (len >= out_len) {
|
||||
- condlog(2, "vpd pg80 overflow, %lu/%lu bytes required",
|
||||
+ condlog(2, "vpd pg80 overflow, %zu/%zu bytes required",
|
||||
len + 1, out_len);
|
||||
len = out_len - 1;
|
||||
}
|
||||
@@ -1087,7 +1087,7 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
|
||||
|
||||
len = sprintf(out, "%d", vpd_type);
|
||||
if (2 * vpd_len >= out_len - len) {
|
||||
- condlog(1, "%s: WWID overflow, type %d, %lu/%lu bytes required",
|
||||
+ condlog(1, "%s: WWID overflow, type %d, %zu/%zu bytes required",
|
||||
__func__, vpd_type,
|
||||
2 * vpd_len + len + 1, out_len);
|
||||
vpd_len = (out_len - len - 1) / 2;
|
||||
@@ -1096,7 +1096,7 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
|
||||
len += sprintf(out + len,
|
||||
"%02x", vpd[i]);
|
||||
} else if (vpd_type == 0x8 && vpd_len < 4) {
|
||||
- condlog(1, "%s: VPD length %lu too small for designator type 8",
|
||||
+ condlog(1, "%s: VPD length %zu too small for designator type 8",
|
||||
__func__, vpd_len);
|
||||
return -EINVAL;
|
||||
} else if (vpd_type == 0x8) {
|
||||
@@ -1112,7 +1112,7 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
|
||||
while (len > 2 && vpd[len - 2] == '\0')
|
||||
--len;
|
||||
if (len > out_len - 1) {
|
||||
- condlog(1, "%s: WWID overflow, type 8/%c, %lu/%lu bytes required",
|
||||
+ condlog(1, "%s: WWID overflow, type 8/%c, %zu/%zu bytes required",
|
||||
__func__, out[0], len + 1, out_len);
|
||||
len = out_len - 1;
|
||||
}
|
||||
@@ -1136,7 +1136,7 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
|
||||
while ((p = memchr(vpd, ' ', vpd_len))) {
|
||||
p_len = p - vpd;
|
||||
if (len + p_len > out_len - 1) {
|
||||
- condlog(1, "%s: WWID overflow, type 1, %lu/%lu bytes required",
|
||||
+ condlog(1, "%s: WWID overflow, type 1, %zu/%zu bytes required",
|
||||
__func__, len + p_len, out_len);
|
||||
p_len = out_len - len - 1;
|
||||
}
|
||||
@@ -1162,7 +1162,7 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
|
||||
p_len = vpd_len;
|
||||
if (p_len > 0 && len < out_len - 1) {
|
||||
if (len + p_len > out_len - 1) {
|
||||
- condlog(1, "%s: WWID overflow, type 1, %lu/%lu bytes required",
|
||||
+ condlog(1, "%s: WWID overflow, type 1, %zu/%zu bytes required",
|
||||
__func__, len + p_len + 1, out_len);
|
||||
p_len = out_len - len - 1;
|
||||
}
|
||||
@@ -1186,14 +1186,14 @@ parse_vpd_c0_hp3par(const unsigned char *in, size_t in_len,
|
||||
|
||||
memset(out, 0x0, out_len);
|
||||
if (in_len <= 4 || (in[4] > 3 && in_len < 44)) {
|
||||
- condlog(3, "HP/3PAR vendor specific VPD page length too short: %lu", in_len);
|
||||
+ condlog(3, "HP/3PAR vendor specific VPD page length too short: %zu", in_len);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (in[4] <= 3) /* revision must be > 3 to have Vomlume Name */
|
||||
return -ENODATA;
|
||||
len = get_unaligned_be32(&in[40]);
|
||||
if (len > out_len || len + 44 > in_len) {
|
||||
- condlog(3, "HP/3PAR vendor specific Volume name too long: %lu",
|
||||
+ condlog(3, "HP/3PAR vendor specific Volume name too long: %zu",
|
||||
len);
|
||||
return -EINVAL;
|
||||
}
|
||||
--
|
||||
2.17.2
|
||||
|
@ -1,204 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Fri, 1 Nov 2019 10:33:04 -0500
|
||||
Subject: [PATCH] libmultipath: fix sgio_get_vpd looping
|
||||
|
||||
If do_inq returns a page with a length that is less than maxlen, but
|
||||
larger than DEFAULT_SGIO_LEN, this function will loop forever. Also
|
||||
if do_inq returns with a length equal to or greater than maxlen,
|
||||
sgio_get_vpd will exit immediately, even if it hasn't read the entire
|
||||
page. Fix these issues, modify the tests to verify the new behavior.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/discovery.c | 12 +++---
|
||||
tests/vpd.c | 84 ++++++++++++++++++++++++----------------
|
||||
2 files changed, 57 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
|
||||
index 72f455e8..3c72a80a 100644
|
||||
--- a/libmultipath/discovery.c
|
||||
+++ b/libmultipath/discovery.c
|
||||
@@ -870,6 +870,7 @@ static int
|
||||
sgio_get_vpd (unsigned char * buff, int maxlen, int fd, int pg)
|
||||
{
|
||||
int len = DEFAULT_SGIO_LEN;
|
||||
+ int rlen;
|
||||
|
||||
if (fd < 0) {
|
||||
errno = EBADF;
|
||||
@@ -877,12 +878,11 @@ sgio_get_vpd (unsigned char * buff, int maxlen, int fd, int pg)
|
||||
}
|
||||
retry:
|
||||
if (0 == do_inq(fd, 0, 1, pg, buff, len)) {
|
||||
- len = get_unaligned_be16(&buff[2]) + 4;
|
||||
- if (len >= maxlen)
|
||||
- return len;
|
||||
- if (len > DEFAULT_SGIO_LEN)
|
||||
- goto retry;
|
||||
- return len;
|
||||
+ rlen = get_unaligned_be16(&buff[2]) + 4;
|
||||
+ if (rlen <= len || len >= maxlen)
|
||||
+ return rlen;
|
||||
+ len = (rlen < maxlen)? rlen : maxlen;
|
||||
+ goto retry;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
diff --git a/tests/vpd.c b/tests/vpd.c
|
||||
index d9f80eaa..4dbce010 100644
|
||||
--- a/tests/vpd.c
|
||||
+++ b/tests/vpd.c
|
||||
@@ -306,7 +306,7 @@ static int create_vpd83(unsigned char *buf, size_t bufsiz, const char *id,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
- put_unaligned_be16(n, buf + 2);
|
||||
+ put_unaligned_be16(bufsiz, buf + 2);
|
||||
return n + 4;
|
||||
}
|
||||
|
||||
@@ -429,6 +429,8 @@ static void test_vpd_vnd_ ## len ## _ ## wlen(void **state) \
|
||||
free(exp_wwid); \
|
||||
will_return(__wrap_ioctl, n); \
|
||||
will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
+ will_return(__wrap_ioctl, n); \
|
||||
+ will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
ret = get_vpd_sgio(10, 0x83, vt->wwid, wlen); \
|
||||
assert_correct_wwid("test_vpd_vnd_" #len "_" #wlen, \
|
||||
exp_len, ret, '1', 0, false, \
|
||||
@@ -459,6 +461,8 @@ static void test_vpd_str_ ## typ ## _ ## len ## _ ## wlen(void **state) \
|
||||
exp_len = wlen - 1; \
|
||||
will_return(__wrap_ioctl, n); \
|
||||
will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
+ will_return(__wrap_ioctl, n); \
|
||||
+ will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
ret = get_vpd_sgio(10, 0x83, vt->wwid, wlen); \
|
||||
assert_correct_wwid("test_vpd_str_" #typ "_" #len "_" #wlen, \
|
||||
exp_len, ret, byte0[type], 0, \
|
||||
@@ -496,6 +500,8 @@ static void test_vpd_naa_ ## naa ## _ ## wlen(void **state) \
|
||||
3, naa, 0); \
|
||||
will_return(__wrap_ioctl, n); \
|
||||
will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
+ will_return(__wrap_ioctl, n); \
|
||||
+ will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
ret = get_vpd_sgio(10, 0x83, vt->wwid, wlen); \
|
||||
assert_correct_wwid("test_vpd_naa_" #naa "_" #wlen, \
|
||||
exp_len, ret, '3', '0' + naa, true, \
|
||||
@@ -506,22 +512,26 @@ static void test_vpd_naa_ ## naa ## _ ## wlen(void **state) \
|
||||
* test_vpd_eui_LEN_WLEN() - test code for VPD 83, EUI64
|
||||
* @LEN: EUI64 length (8, 12, or 16)
|
||||
* @WLEN: WWID buffer size
|
||||
+ * @SML: Use small VPD page size
|
||||
*/
|
||||
-#define make_test_vpd_eui(len, wlen) \
|
||||
-static void test_vpd_eui_ ## len ## _ ## wlen(void **state) \
|
||||
+#define make_test_vpd_eui(len, wlen, sml) \
|
||||
+static void test_vpd_eui_ ## len ## _ ## wlen ## _ ## sml(void **state) \
|
||||
{ \
|
||||
struct vpdtest *vt = *state; \
|
||||
int n, ret; \
|
||||
/* returned size is always uneven */ \
|
||||
int exp_len = wlen > 2 * len + 1 ? 2 * len + 1 : \
|
||||
wlen % 2 == 0 ? wlen - 1 : wlen - 2; \
|
||||
+ int bufsize = sml ? 255 : sizeof(vt->vpdbuf); \
|
||||
\
|
||||
- n = create_vpd83(vt->vpdbuf, sizeof(vt->vpdbuf), test_id, \
|
||||
+ n = create_vpd83(vt->vpdbuf, bufsize, test_id, \
|
||||
2, 0, len); \
|
||||
will_return(__wrap_ioctl, n); \
|
||||
will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
+ will_return(__wrap_ioctl, n); \
|
||||
+ will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
ret = get_vpd_sgio(10, 0x83, vt->wwid, wlen); \
|
||||
- assert_correct_wwid("test_vpd_eui_" #len "_" #wlen, \
|
||||
+ assert_correct_wwid("test_vpd_eui_" #len "_" #wlen "_" #sml, \
|
||||
exp_len, ret, '2', 0, true, \
|
||||
test_id, vt->wwid); \
|
||||
}
|
||||
@@ -603,25 +613,30 @@ make_test_vpd_vnd(20, 10);
|
||||
make_test_vpd_vnd(10, 10);
|
||||
|
||||
/* EUI64 tests */
|
||||
+/* small vpd page test */
|
||||
+make_test_vpd_eui(8, 32, 1);
|
||||
+make_test_vpd_eui(12, 32, 1);
|
||||
+make_test_vpd_eui(16, 40, 1);
|
||||
+
|
||||
/* 64bit, WWID size: 18 */
|
||||
-make_test_vpd_eui(8, 32);
|
||||
-make_test_vpd_eui(8, 18);
|
||||
-make_test_vpd_eui(8, 17);
|
||||
-make_test_vpd_eui(8, 16);
|
||||
-make_test_vpd_eui(8, 10);
|
||||
+make_test_vpd_eui(8, 32, 0);
|
||||
+make_test_vpd_eui(8, 18, 0);
|
||||
+make_test_vpd_eui(8, 17, 0);
|
||||
+make_test_vpd_eui(8, 16, 0);
|
||||
+make_test_vpd_eui(8, 10, 0);
|
||||
|
||||
/* 96 bit, WWID size: 26 */
|
||||
-make_test_vpd_eui(12, 32);
|
||||
-make_test_vpd_eui(12, 26);
|
||||
-make_test_vpd_eui(12, 25);
|
||||
-make_test_vpd_eui(12, 20);
|
||||
-make_test_vpd_eui(12, 10);
|
||||
+make_test_vpd_eui(12, 32, 0);
|
||||
+make_test_vpd_eui(12, 26, 0);
|
||||
+make_test_vpd_eui(12, 25, 0);
|
||||
+make_test_vpd_eui(12, 20, 0);
|
||||
+make_test_vpd_eui(12, 10, 0);
|
||||
|
||||
/* 128 bit, WWID size: 34 */
|
||||
-make_test_vpd_eui(16, 40);
|
||||
-make_test_vpd_eui(16, 34);
|
||||
-make_test_vpd_eui(16, 33);
|
||||
-make_test_vpd_eui(16, 20);
|
||||
+make_test_vpd_eui(16, 40, 0);
|
||||
+make_test_vpd_eui(16, 34, 0);
|
||||
+make_test_vpd_eui(16, 33, 0);
|
||||
+make_test_vpd_eui(16, 20, 0);
|
||||
|
||||
/* NAA IEEE registered extended (36), WWID size: 34 */
|
||||
make_test_vpd_naa(6, 40);
|
||||
@@ -722,20 +737,23 @@ static int test_vpd(void)
|
||||
cmocka_unit_test(test_vpd_vnd_19_20),
|
||||
cmocka_unit_test(test_vpd_vnd_20_10),
|
||||
cmocka_unit_test(test_vpd_vnd_10_10),
|
||||
- cmocka_unit_test(test_vpd_eui_8_32),
|
||||
- cmocka_unit_test(test_vpd_eui_8_18),
|
||||
- cmocka_unit_test(test_vpd_eui_8_17),
|
||||
- cmocka_unit_test(test_vpd_eui_8_16),
|
||||
- cmocka_unit_test(test_vpd_eui_8_10),
|
||||
- cmocka_unit_test(test_vpd_eui_12_32),
|
||||
- cmocka_unit_test(test_vpd_eui_12_26),
|
||||
- cmocka_unit_test(test_vpd_eui_12_25),
|
||||
- cmocka_unit_test(test_vpd_eui_12_20),
|
||||
- cmocka_unit_test(test_vpd_eui_12_10),
|
||||
- cmocka_unit_test(test_vpd_eui_16_40),
|
||||
- cmocka_unit_test(test_vpd_eui_16_34),
|
||||
- cmocka_unit_test(test_vpd_eui_16_33),
|
||||
- cmocka_unit_test(test_vpd_eui_16_20),
|
||||
+ cmocka_unit_test(test_vpd_eui_8_32_1),
|
||||
+ cmocka_unit_test(test_vpd_eui_12_32_1),
|
||||
+ cmocka_unit_test(test_vpd_eui_16_40_1),
|
||||
+ cmocka_unit_test(test_vpd_eui_8_32_0),
|
||||
+ cmocka_unit_test(test_vpd_eui_8_18_0),
|
||||
+ cmocka_unit_test(test_vpd_eui_8_17_0),
|
||||
+ cmocka_unit_test(test_vpd_eui_8_16_0),
|
||||
+ cmocka_unit_test(test_vpd_eui_8_10_0),
|
||||
+ cmocka_unit_test(test_vpd_eui_12_32_0),
|
||||
+ cmocka_unit_test(test_vpd_eui_12_26_0),
|
||||
+ cmocka_unit_test(test_vpd_eui_12_25_0),
|
||||
+ cmocka_unit_test(test_vpd_eui_12_20_0),
|
||||
+ cmocka_unit_test(test_vpd_eui_12_10_0),
|
||||
+ cmocka_unit_test(test_vpd_eui_16_40_0),
|
||||
+ cmocka_unit_test(test_vpd_eui_16_34_0),
|
||||
+ cmocka_unit_test(test_vpd_eui_16_33_0),
|
||||
+ cmocka_unit_test(test_vpd_eui_16_20_0),
|
||||
cmocka_unit_test(test_vpd_naa_6_40),
|
||||
cmocka_unit_test(test_vpd_naa_6_34),
|
||||
cmocka_unit_test(test_vpd_naa_6_33),
|
||||
--
|
||||
2.17.2
|
||||
|
@ -1,116 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Fri, 1 Nov 2019 12:35:47 -0500
|
||||
Subject: [PATCH] libmultipath: add vend_id to get_vpd_sgio
|
||||
|
||||
This tells multipath how it should decode vendor specific pages. It will
|
||||
be used by a future patch.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/discovery.c | 4 ++--
|
||||
libmultipath/discovery.h | 2 +-
|
||||
libmultipath/propsel.c | 2 +-
|
||||
tests/vpd.c | 10 +++++-----
|
||||
4 files changed, 9 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
|
||||
index 3c72a80a..1d79cbae 100644
|
||||
--- a/libmultipath/discovery.c
|
||||
+++ b/libmultipath/discovery.c
|
||||
@@ -1135,7 +1135,7 @@ get_vpd_sysfs (struct udev_device *parent, int pg, char * str, int maxlen)
|
||||
}
|
||||
|
||||
int
|
||||
-get_vpd_sgio (int fd, int pg, char * str, int maxlen)
|
||||
+get_vpd_sgio (int fd, int pg, int vend_id, char * str, int maxlen)
|
||||
{
|
||||
int len, buff_len;
|
||||
unsigned char buff[4096];
|
||||
@@ -1810,7 +1810,7 @@ static ssize_t uid_fallback(struct path *pp, int path_state,
|
||||
if (len < 0 && path_state == PATH_UP) {
|
||||
condlog(1, "%s: failed to get sysfs uid: %s",
|
||||
pp->dev, strerror(-len));
|
||||
- len = get_vpd_sgio(pp->fd, 0x83, pp->wwid,
|
||||
+ len = get_vpd_sgio(pp->fd, 0x83, 0, pp->wwid,
|
||||
WWID_SIZE);
|
||||
*origin = "sgio";
|
||||
}
|
||||
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
|
||||
index 8d04c2af..2f2fd9eb 100644
|
||||
--- a/libmultipath/discovery.h
|
||||
+++ b/libmultipath/discovery.h
|
||||
@@ -35,7 +35,7 @@ int path_get_tpgs(struct path *pp); /* This function never returns TPGS_UNDEF */
|
||||
int do_tur (char *);
|
||||
int path_offline (struct path *);
|
||||
int get_state (struct path * pp, struct config * conf, int daemon, int state);
|
||||
-int get_vpd_sgio (int fd, int pg, char * str, int maxlen);
|
||||
+int get_vpd_sgio (int fd, int pg, int vend_id, char * str, int maxlen);
|
||||
int pathinfo (struct path * pp, struct config * conf, int mask);
|
||||
int alloc_path_with_pathinfo (struct config *conf, struct udev_device *udevice,
|
||||
const char *wwid, int flag, struct path **pp_ptr);
|
||||
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
|
||||
index 27e8d68a..b5b5b89f 100644
|
||||
--- a/libmultipath/propsel.c
|
||||
+++ b/libmultipath/propsel.c
|
||||
@@ -490,7 +490,7 @@ check_rdac(struct path * pp)
|
||||
if (__do_set_from_hwe(checker_name, pp, checker_name) &&
|
||||
strcmp(checker_name, RDAC))
|
||||
return 0;
|
||||
- len = get_vpd_sgio(pp->fd, 0xC9, buff, 44);
|
||||
+ len = get_vpd_sgio(pp->fd, 0xC9, 0, buff, 44);
|
||||
if (len <= 0)
|
||||
return 0;
|
||||
return !(memcmp(buff + 4, "vac1", 4));
|
||||
diff --git a/tests/vpd.c b/tests/vpd.c
|
||||
index 4dbce010..02d6e0bb 100644
|
||||
--- a/tests/vpd.c
|
||||
+++ b/tests/vpd.c
|
||||
@@ -431,7 +431,7 @@ static void test_vpd_vnd_ ## len ## _ ## wlen(void **state) \
|
||||
will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
will_return(__wrap_ioctl, n); \
|
||||
will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
- ret = get_vpd_sgio(10, 0x83, vt->wwid, wlen); \
|
||||
+ ret = get_vpd_sgio(10, 0x83, 0, vt->wwid, wlen); \
|
||||
assert_correct_wwid("test_vpd_vnd_" #len "_" #wlen, \
|
||||
exp_len, ret, '1', 0, false, \
|
||||
exp_subst, vt->wwid); \
|
||||
@@ -463,7 +463,7 @@ static void test_vpd_str_ ## typ ## _ ## len ## _ ## wlen(void **state) \
|
||||
will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
will_return(__wrap_ioctl, n); \
|
||||
will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
- ret = get_vpd_sgio(10, 0x83, vt->wwid, wlen); \
|
||||
+ ret = get_vpd_sgio(10, 0x83, 0, vt->wwid, wlen); \
|
||||
assert_correct_wwid("test_vpd_str_" #typ "_" #len "_" #wlen, \
|
||||
exp_len, ret, byte0[type], 0, \
|
||||
type != STR_IQN, \
|
||||
@@ -502,7 +502,7 @@ static void test_vpd_naa_ ## naa ## _ ## wlen(void **state) \
|
||||
will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
will_return(__wrap_ioctl, n); \
|
||||
will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
- ret = get_vpd_sgio(10, 0x83, vt->wwid, wlen); \
|
||||
+ ret = get_vpd_sgio(10, 0x83, 0, vt->wwid, wlen); \
|
||||
assert_correct_wwid("test_vpd_naa_" #naa "_" #wlen, \
|
||||
exp_len, ret, '3', '0' + naa, true, \
|
||||
test_id, vt->wwid); \
|
||||
@@ -530,7 +530,7 @@ static void test_vpd_eui_ ## len ## _ ## wlen ## _ ## sml(void **state) \
|
||||
will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
will_return(__wrap_ioctl, n); \
|
||||
will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
- ret = get_vpd_sgio(10, 0x83, vt->wwid, wlen); \
|
||||
+ ret = get_vpd_sgio(10, 0x83, 0, vt->wwid, wlen); \
|
||||
assert_correct_wwid("test_vpd_eui_" #len "_" #wlen "_" #sml, \
|
||||
exp_len, ret, '2', 0, true, \
|
||||
test_id, vt->wwid); \
|
||||
@@ -557,7 +557,7 @@ static void test_vpd80_ ## size ## _ ## len ## _ ## wlen(void **state) \
|
||||
size, len); \
|
||||
will_return(__wrap_ioctl, n); \
|
||||
will_return(__wrap_ioctl, vt->vpdbuf); \
|
||||
- ret = get_vpd_sgio(10, 0x80, vt->wwid, wlen); \
|
||||
+ ret = get_vpd_sgio(10, 0x80, 0, vt->wwid, wlen); \
|
||||
assert_correct_wwid("test_vpd80_" #size "_" #len "_" #wlen, \
|
||||
exp_len, ret, 0, 0, false, \
|
||||
input, vt->wwid); \
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,185 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Tue, 12 May 2020 00:39:26 +0200
|
||||
Subject: [PATCH] libmultipath: eliminate more signed/unsigned comparisons
|
||||
|
||||
Fix some more compiler warnings about signed/unsigned comparison.
|
||||
I've observed these only on 32bit builds, therefore they went unnoticed
|
||||
before.
|
||||
|
||||
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/print.c | 12 ++++++------
|
||||
libmultipath/prioritizers/alua_spc3.h | 2 +-
|
||||
multipathd/cli_handlers.c | 20 ++++++++++----------
|
||||
multipathd/main.c | 2 +-
|
||||
4 files changed, 18 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/print.c b/libmultipath/print.c
|
||||
index b944ef32..298b3764 100644
|
||||
--- a/libmultipath/print.c
|
||||
+++ b/libmultipath/print.c
|
||||
@@ -1958,25 +1958,25 @@ char *snprint_config(const struct config *conf, int *len,
|
||||
}
|
||||
|
||||
c = reply + snprint_defaults(conf, reply, maxlen);
|
||||
- if ((c - reply) == maxlen)
|
||||
+ if (c == reply + maxlen)
|
||||
continue;
|
||||
|
||||
c += snprint_blacklist(conf, c, reply + maxlen - c);
|
||||
- if ((c - reply) == maxlen)
|
||||
+ if (c == reply + maxlen)
|
||||
continue;
|
||||
|
||||
c += snprint_blacklist_except(conf, c, reply + maxlen - c);
|
||||
- if ((c - reply) == maxlen)
|
||||
+ if (c == reply + maxlen)
|
||||
continue;
|
||||
|
||||
c += snprint_hwtable(conf, c, reply + maxlen - c,
|
||||
hwtable ? hwtable : conf->hwtable);
|
||||
- if ((c - reply) == maxlen)
|
||||
+ if (c == reply + maxlen)
|
||||
continue;
|
||||
|
||||
c += snprint_overrides(conf, c, reply + maxlen - c,
|
||||
conf->overrides);
|
||||
- if ((c - reply) == maxlen)
|
||||
+ if (c == reply + maxlen)
|
||||
continue;
|
||||
|
||||
if (VECTOR_SIZE(conf->mptable) > 0 ||
|
||||
@@ -1984,7 +1984,7 @@ char *snprint_config(const struct config *conf, int *len,
|
||||
c += snprint_mptable(conf, c, reply + maxlen - c,
|
||||
mpvec);
|
||||
|
||||
- if ((c - reply) < maxlen) {
|
||||
+ if (c < reply + maxlen) {
|
||||
if (len)
|
||||
*len = c - reply;
|
||||
return reply;
|
||||
diff --git a/libmultipath/prioritizers/alua_spc3.h b/libmultipath/prioritizers/alua_spc3.h
|
||||
index 18b495ef..7ba2cf4c 100644
|
||||
--- a/libmultipath/prioritizers/alua_spc3.h
|
||||
+++ b/libmultipath/prioritizers/alua_spc3.h
|
||||
@@ -284,7 +284,7 @@ struct rtpg_data {
|
||||
#define RTPG_FOR_EACH_PORT_GROUP(p, g) \
|
||||
for( \
|
||||
g = &(p->data[0]); \
|
||||
- (((char *) g) - ((char *) p)) < get_unaligned_be32(p->length); \
|
||||
+ ((char *) g) < ((char *) p) + get_unaligned_be32(p->length); \
|
||||
g = (struct rtpg_tpg_dscr *) ( \
|
||||
((char *) g) + \
|
||||
sizeof(struct rtpg_tpg_dscr) + \
|
||||
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
|
||||
index 7d878c88..31c3d9fd 100644
|
||||
--- a/multipathd/cli_handlers.c
|
||||
+++ b/multipathd/cli_handlers.c
|
||||
@@ -66,7 +66,7 @@ show_paths (char ** r, int * len, struct vectors * vecs, char * style,
|
||||
c += snprint_foreign_paths(c, reply + maxlen - c,
|
||||
style, pretty);
|
||||
|
||||
- again = ((c - reply) == (maxlen - 1));
|
||||
+ again = (c == reply + maxlen - 1);
|
||||
|
||||
REALLOC_REPLY(reply, again, maxlen);
|
||||
}
|
||||
@@ -102,7 +102,7 @@ show_path (char ** r, int * len, struct vectors * vecs, struct path *pp,
|
||||
|
||||
c += snprint_path(c, reply + maxlen - c, style, pp, 0);
|
||||
|
||||
- again = ((c - reply) == (maxlen - 1));
|
||||
+ again = (c == reply + maxlen - 1);
|
||||
|
||||
REALLOC_REPLY(reply, again, maxlen);
|
||||
}
|
||||
@@ -131,7 +131,7 @@ show_map_topology (char ** r, int * len, struct multipath * mpp,
|
||||
c = reply;
|
||||
|
||||
c += snprint_multipath_topology(c, reply + maxlen - c, mpp, 2);
|
||||
- again = ((c - reply) == (maxlen - 1));
|
||||
+ again = (c == reply + maxlen - 1);
|
||||
|
||||
REALLOC_REPLY(reply, again, maxlen);
|
||||
}
|
||||
@@ -171,7 +171,7 @@ show_maps_topology (char ** r, int * len, struct vectors * vecs)
|
||||
}
|
||||
c += snprint_foreign_topology(c, reply + maxlen - c, 2);
|
||||
|
||||
- again = ((c - reply) == (maxlen - 1));
|
||||
+ again = (c == reply + maxlen - 1);
|
||||
|
||||
REALLOC_REPLY(reply, again, maxlen);
|
||||
}
|
||||
@@ -209,7 +209,7 @@ show_maps_json (char ** r, int * len, struct vectors * vecs)
|
||||
c = reply;
|
||||
|
||||
c += snprint_multipath_topology_json(c, maxlen, vecs);
|
||||
- again = ((c - reply) == maxlen);
|
||||
+ again = (c == reply + maxlen);
|
||||
|
||||
REALLOC_REPLY(reply, again, maxlen);
|
||||
}
|
||||
@@ -238,7 +238,7 @@ show_map_json (char ** r, int * len, struct multipath * mpp,
|
||||
c = reply;
|
||||
|
||||
c += snprint_multipath_map_json(c, maxlen, mpp);
|
||||
- again = ((c - reply) == maxlen);
|
||||
+ again = (c == reply + maxlen);
|
||||
|
||||
REALLOC_REPLY(reply, again, maxlen);
|
||||
}
|
||||
@@ -487,7 +487,7 @@ show_map (char ** r, int *len, struct multipath * mpp, char * style,
|
||||
c += snprint_multipath(c, reply + maxlen - c, style,
|
||||
mpp, pretty);
|
||||
|
||||
- again = ((c - reply) == (maxlen - 1));
|
||||
+ again = (c == reply + maxlen - 1);
|
||||
|
||||
REALLOC_REPLY(reply, again, maxlen);
|
||||
}
|
||||
@@ -533,7 +533,7 @@ show_maps (char ** r, int *len, struct vectors * vecs, char * style,
|
||||
}
|
||||
c += snprint_foreign_multipaths(c, reply + maxlen - c,
|
||||
style, pretty);
|
||||
- again = ((c - reply) == (maxlen - 1));
|
||||
+ again = (c == reply + maxlen - 1);
|
||||
|
||||
REALLOC_REPLY(reply, again, maxlen);
|
||||
}
|
||||
@@ -1297,7 +1297,7 @@ show_blacklist (char ** r, int * len)
|
||||
|
||||
c = reply;
|
||||
c += snprint_blacklist_report(conf, c, maxlen);
|
||||
- again = ((c - reply) == maxlen);
|
||||
+ again = (c == reply + maxlen);
|
||||
REALLOC_REPLY(reply, again, maxlen);
|
||||
}
|
||||
pthread_cleanup_pop(1);
|
||||
@@ -1339,7 +1339,7 @@ show_devices (char ** r, int * len, struct vectors *vecs)
|
||||
|
||||
c = reply;
|
||||
c += snprint_devices(conf, c, maxlen, vecs);
|
||||
- again = ((c - reply) == maxlen);
|
||||
+ again = (c == reply + maxlen);
|
||||
REALLOC_REPLY(reply, again, maxlen);
|
||||
}
|
||||
pthread_cleanup_pop(1);
|
||||
diff --git a/multipathd/main.c b/multipathd/main.c
|
||||
index 8baf9abe..6b7db2c0 100644
|
||||
--- a/multipathd/main.c
|
||||
+++ b/multipathd/main.c
|
||||
@@ -2374,7 +2374,7 @@ checkerloop (void *ap)
|
||||
conf = get_multipath_config();
|
||||
max_checkint = conf->max_checkint;
|
||||
put_multipath_config(conf);
|
||||
- if (diff_time.tv_sec > max_checkint)
|
||||
+ if (diff_time.tv_sec > (time_t)max_checkint)
|
||||
condlog(1, "path checkers took longer "
|
||||
"than %lu seconds, consider "
|
||||
"increasing max_polling_interval",
|
||||
--
|
||||
2.17.2
|
||||
|
@ -1,350 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Mon, 4 Nov 2019 15:38:25 -0600
|
||||
Subject: [PATCH] libmultipath: add code to get vendor specific vpd data
|
||||
|
||||
This adds the wildcard 'g' for multipath and path formatted printing,
|
||||
which returns extra data from a device's vendor specific vpd page. The
|
||||
specific vendor vpd page to use, and the vendor/product id to decode it
|
||||
can be set in the hwentry with vpd_vendor_pg and vpd_vendor_id. It can
|
||||
be configured in the devices section of multipath.conf with the
|
||||
vpd_vendor parameter. Currently, the only devices that use this are HPE
|
||||
3PAR arrays, to return the Volume Name.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/config.c | 4 ++++
|
||||
libmultipath/config.h | 2 ++
|
||||
libmultipath/dict.c | 34 ++++++++++++++++++++++++++++++++++
|
||||
libmultipath/discovery.c | 34 +++++++++++++++++++++++++++++++++-
|
||||
libmultipath/hwtable.c | 2 ++
|
||||
libmultipath/print.c | 27 +++++++++++++++++++++++++++
|
||||
libmultipath/propsel.c | 24 ++++++++++++++++++++++++
|
||||
libmultipath/propsel.h | 2 ++
|
||||
libmultipath/structs.h | 9 +++++++++
|
||||
multipath/multipath.conf.5 | 8 ++++++++
|
||||
10 files changed, 145 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libmultipath/config.c b/libmultipath/config.c
|
||||
index 85626e96..72b8d37c 100644
|
||||
--- a/libmultipath/config.c
|
||||
+++ b/libmultipath/config.c
|
||||
@@ -369,6 +369,8 @@ merge_hwe (struct hwentry * dst, struct hwentry * src)
|
||||
merge_num(max_sectors_kb);
|
||||
merge_num(ghost_delay);
|
||||
merge_num(all_tg_pt);
|
||||
+ merge_num(vpd_vendor_pg);
|
||||
+ merge_num(vpd_vendor_id);
|
||||
merge_num(san_path_err_threshold);
|
||||
merge_num(san_path_err_forget_rate);
|
||||
merge_num(san_path_err_recovery_time);
|
||||
@@ -517,6 +519,8 @@ store_hwe (vector hwtable, struct hwentry * dhwe)
|
||||
hwe->detect_prio = dhwe->detect_prio;
|
||||
hwe->detect_checker = dhwe->detect_checker;
|
||||
hwe->ghost_delay = dhwe->ghost_delay;
|
||||
+ hwe->vpd_vendor_pg = dhwe->vpd_vendor_pg;
|
||||
+ hwe->vpd_vendor_id = dhwe->vpd_vendor_id;
|
||||
|
||||
if (dhwe->bl_product && !(hwe->bl_product = set_param_str(dhwe->bl_product)))
|
||||
goto out;
|
||||
diff --git a/libmultipath/config.h b/libmultipath/config.h
|
||||
index e69aa07c..589146de 100644
|
||||
--- a/libmultipath/config.h
|
||||
+++ b/libmultipath/config.h
|
||||
@@ -87,6 +87,8 @@ struct hwentry {
|
||||
int max_sectors_kb;
|
||||
int ghost_delay;
|
||||
int all_tg_pt;
|
||||
+ int vpd_vendor_pg;
|
||||
+ int vpd_vendor_id;
|
||||
char * bl_product;
|
||||
};
|
||||
|
||||
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
|
||||
index 2b046e1d..d6d8b79b 100644
|
||||
--- a/libmultipath/dict.c
|
||||
+++ b/libmultipath/dict.c
|
||||
@@ -1366,6 +1366,39 @@ def_uxsock_timeout_handler(struct config *conf, vector strvec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int
|
||||
+hw_vpd_vendor_handler(struct config *conf, vector strvec)
|
||||
+{
|
||||
+ int rc = 0;
|
||||
+ char *buff;
|
||||
+
|
||||
+ struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable);
|
||||
+ if (!hwe)
|
||||
+ return 1;
|
||||
+
|
||||
+ buff = set_value(strvec);
|
||||
+ if (!buff)
|
||||
+ return 1;
|
||||
+ if (strcmp(buff, "hp3par") == 0) {
|
||||
+ hwe->vpd_vendor_pg = 0xc0;
|
||||
+ hwe->vpd_vendor_id = VPD_VP_HP3PAR;
|
||||
+ } else
|
||||
+ rc = 1;
|
||||
+ FREE(buff);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+snprint_hw_vpd_vendor(struct config *conf, char * buff, int len,
|
||||
+ const void * data)
|
||||
+{
|
||||
+ const struct hwentry * hwe = (const struct hwentry *)data;
|
||||
+
|
||||
+ if (hwe->vpd_vendor_pg == 0xc0 && hwe->vpd_vendor_id == VPD_VP_HP3PAR)
|
||||
+ return snprintf(buff, len, "hp3par");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* blacklist block handlers
|
||||
*/
|
||||
@@ -1806,6 +1839,7 @@ init_keywords(vector keywords)
|
||||
install_keyword("max_sectors_kb", &hw_max_sectors_kb_handler, &snprint_hw_max_sectors_kb);
|
||||
install_keyword("ghost_delay", &hw_ghost_delay_handler, &snprint_hw_ghost_delay);
|
||||
install_keyword("all_tg_pt", &hw_all_tg_pt_handler, &snprint_hw_all_tg_pt);
|
||||
+ install_keyword("vpd_vendor", &hw_vpd_vendor_handler, &snprint_hw_vpd_vendor);
|
||||
install_sublevel_end();
|
||||
|
||||
install_keyword_root("overrides", &overrides_handler);
|
||||
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
|
||||
index 1d79cbae..d2773c3a 100644
|
||||
--- a/libmultipath/discovery.c
|
||||
+++ b/libmultipath/discovery.c
|
||||
@@ -1103,6 +1103,30 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
|
||||
return len;
|
||||
}
|
||||
|
||||
+static int
|
||||
+parse_vpd_c0_hp3par(const unsigned char *in, size_t in_len,
|
||||
+ char *out, size_t out_len)
|
||||
+{
|
||||
+ size_t len;
|
||||
+
|
||||
+ memset(out, 0x0, out_len);
|
||||
+ if (in_len <= 4 || (in[4] > 3 && in_len < 44)) {
|
||||
+ condlog(3, "HP/3PAR vendor specific VPD page length too short: %lu", in_len);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ if (in[4] <= 3) /* revision must be > 3 to have Vomlume Name */
|
||||
+ return -ENODATA;
|
||||
+ len = get_unaligned_be32(&in[40]);
|
||||
+ if (len > out_len || len + 44 > in_len) {
|
||||
+ condlog(3, "HP/3PAR vendor specific Volume name too long: %lu",
|
||||
+ len);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ memcpy(out, &in[44], len);
|
||||
+ out[out_len - 1] = '\0';
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
get_vpd_sysfs (struct udev_device *parent, int pg, char * str, int maxlen)
|
||||
{
|
||||
@@ -1170,7 +1194,9 @@ get_vpd_sgio (int fd, int pg, int vend_id, char * str, int maxlen)
|
||||
len = (buff_len <= maxlen)? buff_len : maxlen;
|
||||
memcpy (str, buff, len);
|
||||
}
|
||||
- } else
|
||||
+ } else if (pg == 0xc0 && vend_id == VPD_VP_HP3PAR)
|
||||
+ len = parse_vpd_c0_hp3par(buff, buff_len, str, maxlen);
|
||||
+ else
|
||||
len = -ENOSYS;
|
||||
|
||||
return len;
|
||||
@@ -1544,6 +1570,12 @@ scsi_ioctl_pathinfo (struct path * pp, struct config *conf, int mask)
|
||||
if (!(mask & DI_SERIAL))
|
||||
return;
|
||||
|
||||
+ select_vpd_vendor_pg(conf, pp);
|
||||
+ select_vpd_vendor_id(conf, pp);
|
||||
+
|
||||
+ if (pp->vpd_vendor_pg != 0 && get_vpd_sgio(pp->fd, pp->vpd_vendor_pg, pp->vpd_vendor_id, pp->vpd_data, sizeof(pp->vpd_data)) < 0)
|
||||
+ condlog(3, "%s: failed to get extra vpd data", pp->dev);
|
||||
+
|
||||
parent = pp->udev;
|
||||
while (parent) {
|
||||
const char *subsys = udev_device_get_subsystem(parent);
|
||||
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
|
||||
index 16627ec5..1f27450c 100644
|
||||
--- a/libmultipath/hwtable.c
|
||||
+++ b/libmultipath/hwtable.c
|
||||
@@ -117,6 +117,8 @@ static struct hwentry default_hw[] = {
|
||||
.no_path_retry = 18,
|
||||
.fast_io_fail = 10,
|
||||
.dev_loss = MAX_DEV_LOSS_TMO,
|
||||
+ .vpd_vendor_pg = 0xc0,
|
||||
+ .vpd_vendor_id = VPD_VP_HP3PAR,
|
||||
},
|
||||
{
|
||||
/* RA8000 / ESA12000 */
|
||||
diff --git a/libmultipath/print.c b/libmultipath/print.c
|
||||
index 907469ad..0aafe3cb 100644
|
||||
--- a/libmultipath/print.c
|
||||
+++ b/libmultipath/print.c
|
||||
@@ -358,6 +358,23 @@ snprint_action (char * buff, size_t len, const struct multipath * mpp)
|
||||
}
|
||||
}
|
||||
|
||||
+static int
|
||||
+snprint_multipath_vpd_data(char * buff, size_t len,
|
||||
+ const struct multipath * mpp)
|
||||
+{
|
||||
+ struct pathgroup * pgp;
|
||||
+ struct path * pp;
|
||||
+ int i, j;
|
||||
+
|
||||
+ vector_foreach_slot(mpp->pg, pgp, i) {
|
||||
+ vector_foreach_slot(pgp->paths, pp, j) {
|
||||
+ if (strlen(pp->vpd_data))
|
||||
+ return snprintf(buff, len, "%s", pp->vpd_data);
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* path info printing functions
|
||||
*/
|
||||
@@ -688,6 +705,14 @@ snprint_path_marginal(char * buff, size_t len, const struct path * pp)
|
||||
return snprintf(buff, len, "normal");
|
||||
}
|
||||
|
||||
+static int
|
||||
+snprint_path_vpd_data(char * buff, size_t len, const struct path * pp)
|
||||
+{
|
||||
+ if (strlen(pp->vpd_data) > 0)
|
||||
+ return snprintf(buff, len, "%s", pp->vpd_data);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
struct multipath_data mpd[] = {
|
||||
{'n', "name", 0, snprint_name},
|
||||
{'w', "uuid", 0, snprint_multipath_uuid},
|
||||
@@ -712,6 +737,7 @@ struct multipath_data mpd[] = {
|
||||
{'p', "prod", 0, snprint_multipath_prod},
|
||||
{'e', "rev", 0, snprint_multipath_rev},
|
||||
{'G', "foreign", 0, snprint_multipath_foreign},
|
||||
+ {'g', "vpd page data", 0, snprint_multipath_vpd_data},
|
||||
{0, NULL, 0 , NULL}
|
||||
};
|
||||
|
||||
@@ -737,6 +763,7 @@ struct path_data pd[] = {
|
||||
{'r', "target WWPN", 0, snprint_tgt_wwpn},
|
||||
{'a', "host adapter", 0, snprint_host_adapter},
|
||||
{'G', "foreign", 0, snprint_path_foreign},
|
||||
+ {'g', "vpd page data", 0, snprint_path_vpd_data},
|
||||
{'0', "failures", 0, snprint_path_failures},
|
||||
{'P', "protocol", 0, snprint_path_protocol},
|
||||
{0, NULL, 0 , NULL}
|
||||
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
|
||||
index b5b5b89f..3c99f2d4 100644
|
||||
--- a/libmultipath/propsel.c
|
||||
+++ b/libmultipath/propsel.c
|
||||
@@ -1203,3 +1203,27 @@ out:
|
||||
origin);
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+int select_vpd_vendor_pg (struct config *conf, struct path *pp)
|
||||
+{
|
||||
+ const char *origin;
|
||||
+
|
||||
+ pp_set_hwe(vpd_vendor_pg);
|
||||
+ pp_set_default(vpd_vendor_pg, 0);
|
||||
+out:
|
||||
+ condlog(3, "%s: vpd_vendor_pg = 0x%x %s", pp->dev, pp->vpd_vendor_pg,
|
||||
+ origin);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int select_vpd_vendor_id (struct config *conf, struct path *pp)
|
||||
+{
|
||||
+ const char *origin;
|
||||
+
|
||||
+ pp_set_hwe(vpd_vendor_id);
|
||||
+ pp_set_default(vpd_vendor_id, 0);
|
||||
+out:
|
||||
+ condlog(3, "%s: vpd_vendor_id = 0x%x %s", pp->dev, pp->vpd_vendor_id,
|
||||
+ origin);
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/libmultipath/propsel.h b/libmultipath/propsel.h
|
||||
index ddfd6262..3f6d319a 100644
|
||||
--- a/libmultipath/propsel.h
|
||||
+++ b/libmultipath/propsel.h
|
||||
@@ -37,3 +37,5 @@ void reconcile_features_with_options(const char *id, char **features,
|
||||
int* no_path_retry,
|
||||
int *retain_hwhandler);
|
||||
int select_all_tg_pt (struct config *conf, struct multipath * mp);
|
||||
+int select_vpd_vendor_pg (struct config *conf, struct path *pp);
|
||||
+int select_vpd_vendor_id (struct config *conf, struct path *pp);
|
||||
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
|
||||
index 1c32a799..1ad5f64a 100644
|
||||
--- a/libmultipath/structs.h
|
||||
+++ b/libmultipath/structs.h
|
||||
@@ -21,6 +21,7 @@
|
||||
#define HOST_NAME_LEN 16
|
||||
#define SLOT_NAME_SIZE 40
|
||||
#define PRKEY_SIZE 19
|
||||
+#define VPD_DATA_SIZE 128
|
||||
|
||||
#define SCSI_VENDOR_SIZE 9
|
||||
#define SCSI_PRODUCT_SIZE 17
|
||||
@@ -243,6 +244,11 @@ struct hd_geometry {
|
||||
};
|
||||
#endif
|
||||
|
||||
+/*
|
||||
+ * from sg_vpd_vendor.c
|
||||
+ */
|
||||
+#define VPD_VP_HP3PAR 4
|
||||
+
|
||||
struct path {
|
||||
char dev[FILE_NAME_SIZE];
|
||||
char dev_t[BLK_DEV_SIZE];
|
||||
@@ -255,6 +261,7 @@ struct path {
|
||||
char rev[PATH_REV_SIZE];
|
||||
char serial[SERIAL_SIZE];
|
||||
char tgt_node_name[NODE_NAME_SIZE];
|
||||
+ char vpd_data[VPD_DATA_SIZE];
|
||||
unsigned long long size;
|
||||
unsigned int checkint;
|
||||
unsigned int tick;
|
||||
@@ -287,6 +294,8 @@ struct path {
|
||||
int io_err_pathfail_starttime;
|
||||
int find_multipaths_timeout;
|
||||
int marginal;
|
||||
+ int vpd_vendor_pg;
|
||||
+ int vpd_vendor_id;
|
||||
/* configlet pointers */
|
||||
vector hwe;
|
||||
struct gen_path generic_path;
|
||||
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
|
||||
index e866da23..dc103fd8 100644
|
||||
--- a/multipath/multipath.conf.5
|
||||
+++ b/multipath/multipath.conf.5
|
||||
@@ -1472,6 +1472,14 @@ the \fIproduct\fR attribute set to the value of \fIproduct_blacklist\fR.
|
||||
The user_friendly_names prefix to use for this
|
||||
device type, instead of the default "mpath".
|
||||
.TP
|
||||
+.B vpd_vendor
|
||||
+The vendor specific vpd page information, using the vpd page abbreviation.
|
||||
+The vpd page abbreviation can be found by running \fIsg_vpd -e\fR. multipathd
|
||||
+will use this information to gather device specific information that can be
|
||||
+displayed with the \fI%g\fR wilcard for the \fImultipathd show maps format\fR
|
||||
+and \fImultipathd show paths format\fR commands. Currently only the
|
||||
+\fBhp3par\fR vpd page is supported.
|
||||
+.TP
|
||||
.B hardware_handler
|
||||
The hardware handler to use for this device type.
|
||||
The following hardware handler are implemented:
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Tue, 12 May 2020 00:39:27 +0200
|
||||
Subject: [PATCH] libmultipath: set_uint: fix parsing for 32bit
|
||||
|
||||
On architectures where sizeof(long) == sizeof(int), the code wouldn't
|
||||
work as intended. Use strtoul instead. As strtoul happily parses
|
||||
negative numbers as input, require the number to begin with a digit.
|
||||
|
||||
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/dict.c | 11 +++++++----
|
||||
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
|
||||
index 3e25e74f..0e9ea387 100644
|
||||
--- a/libmultipath/dict.c
|
||||
+++ b/libmultipath/dict.c
|
||||
@@ -60,19 +60,22 @@ static int
|
||||
set_uint(vector strvec, void *ptr)
|
||||
{
|
||||
unsigned int *uint_ptr = (unsigned int *)ptr;
|
||||
- char *buff, *eptr;
|
||||
- long res;
|
||||
+ char *buff, *eptr, *p;
|
||||
+ unsigned long res;
|
||||
int rc;
|
||||
|
||||
buff = set_value(strvec);
|
||||
if (!buff)
|
||||
return 1;
|
||||
|
||||
- res = strtol(buff, &eptr, 10);
|
||||
+ p = buff;
|
||||
+ while (isspace(*p))
|
||||
+ p++;
|
||||
+ res = strtoul(p, &eptr, 10);
|
||||
if (eptr > buff)
|
||||
while (isspace(*eptr))
|
||||
eptr++;
|
||||
- if (*buff == '\0' || *eptr != '\0' || res < 0 || res > UINT_MAX) {
|
||||
+ if (*buff == '\0' || *eptr != '\0' || !isdigit(*p) || res > UINT_MAX) {
|
||||
condlog(1, "%s: invalid value for %s: \"%s\"",
|
||||
__func__, (char*)VECTOR_SLOT(strvec, 0), buff);
|
||||
rc = 1;
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Tue, 12 May 2020 22:38:22 +0200
|
||||
Subject: [PATCH] multipath-tools Makefile: add install dependency
|
||||
|
||||
$(libdir) must exist before running "make install" on prioritizer, checker,
|
||||
and foreign libraries.
|
||||
|
||||
Cc: Christian Hesse <mail@eworm.de>
|
||||
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
Makefile | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index fec3b73b..8bcaba66 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -32,6 +32,10 @@ libmultipath libdmmp: libmpathcmd
|
||||
libmpathpersist multipath multipathd: libmultipath
|
||||
mpathpersist multipathd: libmpathpersist
|
||||
|
||||
+libmultipath/checkers.install \
|
||||
+ libmultipath/prioritizers.install \
|
||||
+ libmultipath/foreign.install: libmultipath.install
|
||||
+
|
||||
$(BUILDDIRS.clean):
|
||||
$(MAKE) -C ${@:.clean=} clean
|
||||
|
||||
--
|
||||
2.17.2
|
||||
|
@ -15,7 +15,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
3 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makefile.inc b/Makefile.inc
|
||||
index 56c3eda0..2e8946ca 100644
|
||||
index 9060ac9b..034752d9 100644
|
||||
--- a/Makefile.inc
|
||||
+++ b/Makefile.inc
|
||||
@@ -53,7 +53,7 @@ endif
|
@ -46,10 +46,10 @@ index 00e8dbdb..d9691b17 100644
|
||||
udev_device_get_properties_list_entry(udev)) {
|
||||
|
||||
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
|
||||
index dc103fd8..b8697d47 100644
|
||||
index 05a5e8ff..3455b1cc 100644
|
||||
--- a/multipath/multipath.conf.5
|
||||
+++ b/multipath/multipath.conf.5
|
||||
@@ -1285,9 +1285,14 @@ keywords. Both are regular expressions. For a full description of these keywords
|
||||
@@ -1286,9 +1286,14 @@ keywords. Both are regular expressions. For a full description of these keywords
|
||||
Regular expression for an udev property. All
|
||||
devices that have matching udev properties will be excluded/included.
|
||||
The handling of the \fIproperty\fR keyword is special,
|
||||
@ -65,7 +65,7 @@ index dc103fd8..b8697d47 100644
|
||||
.
|
||||
.RS
|
||||
.PP
|
||||
@@ -1298,10 +1303,6 @@ Blacklisting by missing properties is only applied to devices which do have the
|
||||
@@ -1299,10 +1304,6 @@ Blacklisting by missing properties is only applied to devices which do have the
|
||||
property specified by \fIuid_attribute\fR (e.g. \fIID_SERIAL\fR)
|
||||
set. Previously, it was applied to every device, possibly causing devices to be
|
||||
blacklisted because of temporary I/O error conditions.
|
||||
@ -77,10 +77,10 @@ index dc103fd8..b8697d47 100644
|
||||
.TP
|
||||
.B protocol
|
||||
diff --git a/tests/blacklist.c b/tests/blacklist.c
|
||||
index 362c44d9..ea284939 100644
|
||||
index 6e7c1864..cc8a9a4a 100644
|
||||
--- a/tests/blacklist.c
|
||||
+++ b/tests/blacklist.c
|
||||
@@ -291,7 +291,7 @@ static void test_property_missing(void **state)
|
||||
@@ -271,7 +271,7 @@ static void test_property_missing(void **state)
|
||||
conf.blist_property = blist_property_wwn;
|
||||
expect_condlog(3, "sdb: blacklisted, udev property missing\n");
|
||||
assert_int_equal(filter_property(&conf, &udev, 3, "ID_SERIAL"),
|
||||
@ -89,7 +89,7 @@ index 362c44d9..ea284939 100644
|
||||
assert_int_equal(filter_property(&conf, &udev, 3, "ID_BLAH"),
|
||||
MATCH_NOTHING);
|
||||
assert_int_equal(filter_property(&conf, &udev, 3, ""),
|
||||
@@ -383,9 +383,7 @@ static void test_filter_path_missing1(void **state)
|
||||
@@ -363,9 +363,7 @@ static void test_filter_path_missing1(void **state)
|
||||
conf.blist_device = blist_device_foo_bar;
|
||||
conf.blist_protocol = blist_protocol_fcp;
|
||||
conf.blist_wwid = blist_wwid_xyzzy;
|
@ -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 72b8d37c..4032c4c4 100644
|
||||
index b4d87689..b36778b0 100644
|
||||
--- a/libmultipath/config.c
|
||||
+++ b/libmultipath/config.c
|
||||
@@ -26,6 +26,7 @@
|
||||
@ -31,7 +31,7 @@ index 72b8d37c..4032c4c4 100644
|
||||
|
||||
static int
|
||||
hwe_strmatch (const struct hwentry *hwe1, const struct hwentry *hwe2)
|
||||
@@ -755,6 +756,20 @@ load_config (char * file)
|
||||
@@ -778,6 +779,20 @@ load_config (char * file)
|
||||
goto out;
|
||||
}
|
||||
factorize_hwtable(conf->hwtable, builtin_hwtable_size, file);
|
||||
@ -53,7 +53,7 @@ index 72b8d37c..4032c4c4 100644
|
||||
|
||||
conf->processed_main_config = 1;
|
||||
diff --git a/libmultipath/config.h b/libmultipath/config.h
|
||||
index 589146de..2adbd077 100644
|
||||
index ceecff2d..3368d8c9 100644
|
||||
--- a/libmultipath/config.h
|
||||
+++ b/libmultipath/config.h
|
||||
@@ -9,6 +9,7 @@
|
@ -9,45 +9,56 @@ still being generic.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
Makefile.inc | 24 ++++++++++++++++--------
|
||||
1 file changed, 16 insertions(+), 8 deletions(-)
|
||||
Makefile.inc | 29 +++++++++++++++++++++--------
|
||||
1 file changed, 21 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/Makefile.inc b/Makefile.inc
|
||||
index 2e8946ca..1b2f47a8 100644
|
||||
index 034752d9..c2abd301 100644
|
||||
--- a/Makefile.inc
|
||||
+++ b/Makefile.inc
|
||||
@@ -88,15 +88,23 @@ TEST_CC_OPTION = $(shell \
|
||||
@@ -89,16 +89,29 @@ TEST_CC_OPTION = $(shell \
|
||||
echo "$(2)"; \
|
||||
fi)
|
||||
|
||||
-STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)
|
||||
ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers,)
|
||||
-
|
||||
-OPTFLAGS = -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int \
|
||||
- -Werror=implicit-function-declaration -Werror=format-security \
|
||||
- -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered \
|
||||
- -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) \
|
||||
- -Wp,-D_FORTIFY_SOURCE=2 $(STACKPROT) \
|
||||
- --param=ssp-buffer-size=4
|
||||
WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)
|
||||
+ifndef RPM_OPT_FLAGS
|
||||
+ STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)
|
||||
+ OPTFLAGS = -O2 -g -pipe -Wall -Werror=format-security \
|
||||
+ -Wp,-D_FORTIFY_SOURCE=2 -fexceptions \
|
||||
+ $(STACKPROT) --param=ssp-buffer-size=4 \
|
||||
+ -grecord-gcc-switches
|
||||
+ $(STACKPROT) -grecord-gcc-switches \
|
||||
+ -fasynchronous-unwind-tables
|
||||
+ ifeq ($(shell test -f /usr/lib/rpm/redhat/redhat-hardened-cc1 && echo 1),1)
|
||||
+ OPTFLAGS += -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
|
||||
+ endif
|
||||
+ ifeq ($(shell test -f /usr/lib/rpm/redhat/redhat-annobin-cc1 && echo 1),1)
|
||||
+ OPTFLAGS += -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
|
||||
+ endif
|
||||
+else
|
||||
+ OPTFLAGS = $(RPM_OPT_FLAGS)
|
||||
+endif
|
||||
+OPTFLAGS += -Wextra -Wstrict-prototypes -Wformat=2 -Werror=implicit-int \
|
||||
+ -Werror=implicit-function-declaration -Wno-sign-compare \
|
||||
+ -Wno-unused-parameter $(ERROR_DISCARDED_QUALIFIERS) \
|
||||
+ -Werror=cast-qual
|
||||
+OPTFLAGS += -Werror -Wextra -Wstrict-prototypes -Wformat=2 \
|
||||
+ -Werror=implicit-int -Werror=implicit-function-declaration \
|
||||
+ $(WNOCLOBBERED) \
|
||||
+ -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) \
|
||||
+ --param=ssp-buffer-size=4
|
||||
|
||||
-OPTFLAGS = -O2 -g -pipe -Werror -Wall -Wextra -Wformat=2 -Werror=implicit-int \
|
||||
- -Werror=implicit-function-declaration -Werror=format-security \
|
||||
- $(WNOCLOBBERED) \
|
||||
- -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) \
|
||||
- $(STACKPROT) --param=ssp-buffer-size=4
|
||||
-CPPFLAGS := -Wp,-D_FORTIFY_SOURCE=2
|
||||
CFLAGS := $(OPTFLAGS) -DBIN_DIR=\"$(bindir)\" -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" \
|
||||
-MMD -MP $(CFLAGS)
|
||||
BIN_CFLAGS = -fPIE -DPIE
|
||||
@@ -135,4 +148,4 @@ check_file = $(shell \
|
||||
|
||||
%.o: %.c
|
||||
@echo building $@ because of $?
|
||||
- $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
+ $(CC) $(CFLAGS) -c -o $@ $<
|
||||
--
|
||||
2.17.2
|
||||
|
@ -21,10 +21,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
create mode 100644 multipath/mpathconf.8
|
||||
|
||||
diff --git a/libmultipath/config.c b/libmultipath/config.c
|
||||
index 4032c4c4..2c32acf7 100644
|
||||
index b36778b0..26f8e050 100644
|
||||
--- a/libmultipath/config.c
|
||||
+++ b/libmultipath/config.c
|
||||
@@ -758,6 +758,8 @@ load_config (char * file)
|
||||
@@ -781,6 +781,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.");
|
||||
@ -630,7 +630,7 @@ index 00000000..f34003c9
|
||||
+fi
|
||||
diff --git a/multipath/mpathconf.8 b/multipath/mpathconf.8
|
||||
new file mode 100644
|
||||
index 00000000..7937ea05
|
||||
index 00000000..b82961d6
|
||||
--- /dev/null
|
||||
+++ b/multipath/mpathconf.8
|
||||
@@ -0,0 +1,135 @@
|
||||
@ -705,7 +705,7 @@ index 00000000..7937ea05
|
||||
+mpathconf will not be able to revert back to its previous state. Because
|
||||
+of this, \fB--outfile\fP is required when using \fB--allow\fP.
|
||||
+.TP
|
||||
+.B --user_friendly_name \fP { \fBy\fP | \fBn\fP }
|
||||
+.B --user_friendly_names \fP { \fBy\fP | \fBn\fP }
|
||||
+If set to \fBy\fP, this adds the line
|
||||
+.B user_friendly_names yes
|
||||
+to the
|
@ -22,10 +22,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
5 files changed, 60 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/wwids.c b/libmultipath/wwids.c
|
||||
index ef748125..349da8b7 100644
|
||||
index 28a2150d..fab6fc8f 100644
|
||||
--- a/libmultipath/wwids.c
|
||||
+++ b/libmultipath/wwids.c
|
||||
@@ -444,3 +444,47 @@ int op ## _wwid(const char *wwid) \
|
||||
@@ -454,3 +454,47 @@ int op ## _wwid(const char *wwid) \
|
||||
declare_failed_wwid_op(is_failed, false)
|
||||
declare_failed_wwid_op(mark_failed, true)
|
||||
declare_failed_wwid_op(unmark_failed, true)
|
||||
@ -86,7 +86,7 @@ index 0c6ee54d..e32a0b0e 100644
|
||||
enum {
|
||||
WWID_IS_NOT_FAILED = 0,
|
||||
diff --git a/multipath/main.c b/multipath/main.c
|
||||
index 4f4d8e89..22aff7be 100644
|
||||
index cf9d2a28..78822ee1 100644
|
||||
--- a/multipath/main.c
|
||||
+++ b/multipath/main.c
|
||||
@@ -138,7 +138,7 @@ usage (char * progname)
|
||||
@ -107,16 +107,16 @@ index 4f4d8e89..22aff7be 100644
|
||||
" -c check if a device should be a path in a multipath device\n"
|
||||
" -C check if a multipath device has usable paths\n"
|
||||
" -q allow queue_if_no_path when multipathd is not running\n"
|
||||
@@ -905,7 +907,7 @@ main (int argc, char *argv[])
|
||||
exit(RTVL_FAIL);
|
||||
@@ -907,7 +909,7 @@ main (int argc, char *argv[])
|
||||
multipath_conf = conf;
|
||||
conf->retrigger_tries = 0;
|
||||
conf->force_sync = 1;
|
||||
- while ((arg = getopt(argc, argv, ":adcChl::FfM:v:p:b:BrR:itTquUwW")) != EOF ) {
|
||||
+ while ((arg = getopt(argc, argv, ":aAdcChl::FfM:v:p:b:BrR:itTquUwW")) != EOF ) {
|
||||
switch(arg) {
|
||||
case 1: printf("optarg : %s\n",optarg);
|
||||
break;
|
||||
@@ -975,6 +977,10 @@ main (int argc, char *argv[])
|
||||
@@ -977,6 +979,10 @@ main (int argc, char *argv[])
|
||||
case 'T':
|
||||
cmd = CMD_DUMP_CONFIG;
|
||||
break;
|
@ -16,10 +16,10 @@ 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 d6d8b79b..07d2ba8f 100644
|
||||
index 0e9ea387..184d4b22 100644
|
||||
--- a/libmultipath/dict.c
|
||||
+++ b/libmultipath/dict.c
|
||||
@@ -58,6 +58,21 @@ set_str(vector strvec, void *ptr)
|
||||
@@ -103,6 +103,21 @@ set_str(vector strvec, void *ptr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ index d6d8b79b..07d2ba8f 100644
|
||||
static int
|
||||
set_yes_no(vector strvec, void *ptr)
|
||||
{
|
||||
@@ -1455,7 +1470,7 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \
|
||||
@@ -1504,7 +1519,7 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \
|
||||
if (!conf->option) \
|
||||
return 1; \
|
||||
\
|
||||
@ -50,7 +50,7 @@ index d6d8b79b..07d2ba8f 100644
|
||||
if (!buff) \
|
||||
return 1; \
|
||||
\
|
||||
@@ -1471,7 +1486,7 @@ ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec) \
|
||||
@@ -1520,7 +1535,7 @@ ble_ ## option ## _ ## name ## _handler (struct config *conf, vector strvec) \
|
||||
if (!conf->option) \
|
||||
return 1; \
|
||||
\
|
||||
@ -59,7 +59,7 @@ index d6d8b79b..07d2ba8f 100644
|
||||
if (!buff) \
|
||||
return 1; \
|
||||
\
|
||||
@@ -1574,16 +1589,16 @@ device_handler(struct config *conf, vector strvec)
|
||||
@@ -1623,16 +1638,16 @@ device_handler(struct config *conf, vector strvec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ index d6d8b79b..07d2ba8f 100644
|
||||
|
||||
declare_hw_handler(hwhandler, set_str)
|
||||
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
|
||||
index e00c5fff..15495d26 100644
|
||||
index d478b177..a184511b 100644
|
||||
--- a/libmultipath/parser.c
|
||||
+++ b/libmultipath/parser.c
|
||||
@@ -382,6 +382,19 @@ oom:
|
@ -12,10 +12,10 @@ 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 4dfe007c..d910da51 100644
|
||||
index e5ee6afe..52fe05b9 100644
|
||||
--- a/libmultipath/defaults.h
|
||||
+++ b/libmultipath/defaults.h
|
||||
@@ -20,7 +20,7 @@
|
||||
@@ -22,7 +22,7 @@
|
||||
#define DEFAULT_NO_PATH_RETRY NO_PATH_RETRY_UNDEF
|
||||
#define DEFAULT_VERBOSITY 2
|
||||
#define DEFAULT_REASSIGN_MAPS 0
|
@ -13,7 +13,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
1 file changed, 29 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/prioritizers/ana.c b/libmultipath/prioritizers/ana.c
|
||||
index 2673d9d9..f34ade28 100644
|
||||
index b5c7873d..e139360c 100644
|
||||
--- a/libmultipath/prioritizers/ana.c
|
||||
+++ b/libmultipath/prioritizers/ana.c
|
||||
@@ -24,6 +24,7 @@
|
||||
@ -40,11 +40,11 @@ index 2673d9d9..f34ade28 100644
|
||||
};
|
||||
|
||||
static const char *anas_string[] = {
|
||||
@@ -106,6 +109,27 @@ static int get_ana_state(__u32 nsid, __u32 anagrpid, void *ana_log,
|
||||
@@ -107,6 +110,27 @@ static int get_ana_state(__u32 nsid, __u32 anagrpid, void *ana_log,
|
||||
return -ANA_ERR_GETANAS_NOTFOUND;
|
||||
}
|
||||
|
||||
+int get_ana_info_sysfs(struct path *pp)
|
||||
+static int get_ana_info_sysfs(struct path *pp)
|
||||
+{
|
||||
+ char state[32];
|
||||
+
|
||||
@ -65,19 +65,19 @@ index 2673d9d9..f34ade28 100644
|
||||
+ return -ANA_ERR_INVALID_STATE;
|
||||
+}
|
||||
+
|
||||
int get_ana_info(struct path * pp, unsigned int timeout)
|
||||
static int get_ana_info(struct path * pp)
|
||||
{
|
||||
int rc;
|
||||
@@ -208,8 +232,11 @@ int getprio(struct path *pp, char *args, unsigned int timeout)
|
||||
@@ -210,8 +234,11 @@ int getprio(struct path *pp, __attribute__((unused)) char *args,
|
||||
|
||||
if (pp->fd < 0)
|
||||
rc = -ANA_ERR_NO_INFORMATION;
|
||||
- else
|
||||
- rc = get_ana_info(pp, timeout);
|
||||
- rc = get_ana_info(pp);
|
||||
+ else {
|
||||
+ rc = get_ana_info_sysfs(pp);
|
||||
+ if (rc < 0)
|
||||
+ rc = get_ana_info(pp, timeout);
|
||||
+ rc = get_ana_info(pp);
|
||||
+ }
|
||||
|
||||
switch (rc) {
|
@ -0,0 +1,139 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Mon, 8 Jun 2020 14:27:51 -0500
|
||||
Subject: [PATCH] libmultipath: remove _blacklist_exceptions functions
|
||||
|
||||
_blacklist_exceptions() and _blacklist_exceptions_device() are exactly
|
||||
the same as _blacklist() and _blacklist_device(), so remove them, and
|
||||
give the remaining functions to a more general name.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/blacklist.c | 62 ++++++++++------------------------------
|
||||
1 file changed, 15 insertions(+), 47 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/blacklist.c b/libmultipath/blacklist.c
|
||||
index d9691b17..04d3adb9 100644
|
||||
--- a/libmultipath/blacklist.c
|
||||
+++ b/libmultipath/blacklist.c
|
||||
@@ -101,21 +101,8 @@ int set_ble_device(vector blist, char * vendor, char * product, int origin)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-int
|
||||
-_blacklist_exceptions (vector elist, const char * str)
|
||||
-{
|
||||
- int i;
|
||||
- struct blentry * ele;
|
||||
-
|
||||
- vector_foreach_slot (elist, ele, i) {
|
||||
- if (!regexec(&ele->regex, str, 0, NULL, 0))
|
||||
- return 1;
|
||||
- }
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-int
|
||||
-_blacklist (vector blist, const char * str)
|
||||
+static int
|
||||
+match_reglist (vector blist, const char * str)
|
||||
{
|
||||
int i;
|
||||
struct blentry * ble;
|
||||
@@ -127,28 +114,9 @@ _blacklist (vector blist, const char * str)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-int
|
||||
-_blacklist_exceptions_device(const struct _vector *elist, const char * vendor,
|
||||
- const char * product)
|
||||
-{
|
||||
- int i;
|
||||
- struct blentry_device * ble;
|
||||
-
|
||||
- vector_foreach_slot (elist, ble, i) {
|
||||
- if (!ble->vendor && !ble->product)
|
||||
- continue;
|
||||
- if ((!ble->vendor ||
|
||||
- !regexec(&ble->vendor_reg, vendor, 0, NULL, 0)) &&
|
||||
- (!ble->product ||
|
||||
- !regexec(&ble->product_reg, product, 0, NULL, 0)))
|
||||
- return 1;
|
||||
- }
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-int
|
||||
-_blacklist_device (const struct _vector *blist, const char * vendor,
|
||||
- const char * product)
|
||||
+static int
|
||||
+match_reglist_device (const struct _vector *blist, const char * vendor,
|
||||
+ const char * product)
|
||||
{
|
||||
int i;
|
||||
struct blentry_device * ble;
|
||||
@@ -294,9 +262,9 @@ filter_device (vector blist, vector elist, char * vendor, char * product,
|
||||
int r = MATCH_NOTHING;
|
||||
|
||||
if (vendor && product) {
|
||||
- if (_blacklist_exceptions_device(elist, vendor, product))
|
||||
+ if (match_reglist_device(elist, vendor, product))
|
||||
r = MATCH_DEVICE_BLIST_EXCEPT;
|
||||
- else if (_blacklist_device(blist, vendor, product))
|
||||
+ else if (match_reglist_device(blist, vendor, product))
|
||||
r = MATCH_DEVICE_BLIST;
|
||||
}
|
||||
|
||||
@@ -310,9 +278,9 @@ filter_devnode (vector blist, vector elist, char * dev)
|
||||
int r = MATCH_NOTHING;
|
||||
|
||||
if (dev) {
|
||||
- if (_blacklist_exceptions(elist, dev))
|
||||
+ if (match_reglist(elist, dev))
|
||||
r = MATCH_DEVNODE_BLIST_EXCEPT;
|
||||
- else if (_blacklist(blist, dev))
|
||||
+ else if (match_reglist(blist, dev))
|
||||
r = MATCH_DEVNODE_BLIST;
|
||||
}
|
||||
|
||||
@@ -326,9 +294,9 @@ filter_wwid (vector blist, vector elist, char * wwid, char * dev)
|
||||
int r = MATCH_NOTHING;
|
||||
|
||||
if (wwid) {
|
||||
- if (_blacklist_exceptions(elist, wwid))
|
||||
+ if (match_reglist(elist, wwid))
|
||||
r = MATCH_WWID_BLIST_EXCEPT;
|
||||
- else if (_blacklist(blist, wwid))
|
||||
+ else if (match_reglist(blist, wwid))
|
||||
r = MATCH_WWID_BLIST;
|
||||
}
|
||||
|
||||
@@ -345,9 +313,9 @@ filter_protocol(vector blist, vector elist, struct path * pp)
|
||||
if (pp) {
|
||||
snprint_path_protocol(buf, sizeof(buf), pp);
|
||||
|
||||
- if (_blacklist_exceptions(elist, buf))
|
||||
+ if (match_reglist(elist, buf))
|
||||
r = MATCH_PROTOCOL_BLIST_EXCEPT;
|
||||
- else if (_blacklist(blist, buf))
|
||||
+ else if (match_reglist(blist, buf))
|
||||
r = MATCH_PROTOCOL_BLIST;
|
||||
}
|
||||
|
||||
@@ -417,11 +385,11 @@ filter_property(struct config *conf, struct udev_device *udev, int lvl,
|
||||
if (check_missing_prop && !strcmp(env, uid_attribute))
|
||||
uid_attr_seen = true;
|
||||
|
||||
- if (_blacklist_exceptions(conf->elist_property, env)) {
|
||||
+ if (match_reglist(conf->elist_property, env)) {
|
||||
r = MATCH_PROPERTY_BLIST_EXCEPT;
|
||||
break;
|
||||
}
|
||||
- if (_blacklist(conf->blist_property, env)) {
|
||||
+ if (match_reglist(conf->blist_property, env)) {
|
||||
r = MATCH_PROPERTY_BLIST;
|
||||
break;
|
||||
}
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,95 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Mon, 8 Jun 2020 20:23:56 -0500
|
||||
Subject: [PATCH] libmultipath: fix parser issue with comments in strings
|
||||
|
||||
If a quoted string starts with '#' or '!', the parser will stop
|
||||
parsing the line, thinking that it's a comment. It should only
|
||||
be checking for comments outside of quoted strings. Fixed this and
|
||||
added unit tests to verify it.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/parser.c | 4 +++-
|
||||
tests/parser.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 45 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
|
||||
index a184511b..a7285a35 100644
|
||||
--- a/libmultipath/parser.c
|
||||
+++ b/libmultipath/parser.c
|
||||
@@ -300,8 +300,10 @@ alloc_strvec(char *string)
|
||||
(isspace((int) *cp) || !isascii((int) *cp)))
|
||||
&& *cp != '\0')
|
||||
cp++;
|
||||
- if (*cp == '\0' || *cp == '!' || *cp == '#')
|
||||
+ if (*cp == '\0' ||
|
||||
+ (!in_string && (*cp == '!' || *cp == '#'))) {
|
||||
return strvec;
|
||||
+ }
|
||||
}
|
||||
out:
|
||||
vector_free(strvec);
|
||||
diff --git a/tests/parser.c b/tests/parser.c
|
||||
index 29859dac..5772391e 100644
|
||||
--- a/tests/parser.c
|
||||
+++ b/tests/parser.c
|
||||
@@ -440,6 +440,46 @@ static void test18(void **state)
|
||||
free_strvec(v);
|
||||
}
|
||||
|
||||
+static void test19(void **state)
|
||||
+{
|
||||
+#define QUOTED19 "!value"
|
||||
+ vector v = alloc_strvec("key \"" QUOTED19 "\"");
|
||||
+ char *val;
|
||||
+
|
||||
+ assert_int_equal(VECTOR_SIZE(v), 4);
|
||||
+ assert_string_equal(VECTOR_SLOT(v, 0), "key");
|
||||
+ assert_true(is_quote(VECTOR_SLOT(v, 1)));
|
||||
+ assert_string_equal(VECTOR_SLOT(v, 2), QUOTED19);
|
||||
+ assert_true(is_quote(VECTOR_SLOT(v, 3)));
|
||||
+ assert_int_equal(validate_config_strvec(v, test_file), 0);
|
||||
+
|
||||
+ val = set_value(v);
|
||||
+ assert_string_equal(val, QUOTED19);
|
||||
+
|
||||
+ free(val);
|
||||
+ free_strvec(v);
|
||||
+}
|
||||
+
|
||||
+static void test20(void **state)
|
||||
+{
|
||||
+#define QUOTED20 "#value"
|
||||
+ vector v = alloc_strvec("key \"" QUOTED20 "\"");
|
||||
+ char *val;
|
||||
+
|
||||
+ assert_int_equal(VECTOR_SIZE(v), 4);
|
||||
+ assert_string_equal(VECTOR_SLOT(v, 0), "key");
|
||||
+ assert_true(is_quote(VECTOR_SLOT(v, 1)));
|
||||
+ assert_string_equal(VECTOR_SLOT(v, 2), QUOTED20);
|
||||
+ assert_true(is_quote(VECTOR_SLOT(v, 3)));
|
||||
+ assert_int_equal(validate_config_strvec(v, test_file), 0);
|
||||
+
|
||||
+ val = set_value(v);
|
||||
+ assert_string_equal(val, QUOTED20);
|
||||
+
|
||||
+ free(val);
|
||||
+ free_strvec(v);
|
||||
+}
|
||||
+
|
||||
int test_config_parser(void)
|
||||
{
|
||||
const struct CMUnitTest tests[] = {
|
||||
@@ -461,6 +501,8 @@ int test_config_parser(void)
|
||||
cmocka_unit_test(test16),
|
||||
cmocka_unit_test(test17),
|
||||
cmocka_unit_test(test18),
|
||||
+ cmocka_unit_test(test19),
|
||||
+ cmocka_unit_test(test20),
|
||||
};
|
||||
return cmocka_run_group_tests(tests, setup, teardown);
|
||||
}
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,435 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Mon, 8 Jun 2020 13:40:16 -0500
|
||||
Subject: [PATCH] libmultipath: invert regexes that start with exclamation
|
||||
point
|
||||
|
||||
The number of devices that multipath needs to blacklist keeps growing,
|
||||
and the udev rules already have
|
||||
|
||||
KERNEL!="sd*|dasd*|nvme*", GOTO="end_mpath"
|
||||
|
||||
so they only work correctly with these device types. Instead of
|
||||
individually blacklisting every type of device that can't be
|
||||
multipathed, multipath's default blacklist should work like the udev
|
||||
rule, and blacklist all devices that aren't scsi, dasd, or nvme.
|
||||
Unfortunately, the c regex library doesn't support negative lookahead.
|
||||
Instead, multipath should treat "!" at the beginning of
|
||||
blacklist/exceptions regexes as inverse matching the rest of the regex.
|
||||
If users need to match a literal '!' as the first character of their
|
||||
regex, they can use "\!" instead. This allows multipath to change the
|
||||
default devnode blacklist regex to "!^(sd[a-z]|dasd[a-z]|nvme[0-9])".
|
||||
|
||||
Extra tests have been added to the blacklist unit tests to verify the
|
||||
inverse matching code and the new default blacklist.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/blacklist.c | 41 +++++++++-----
|
||||
libmultipath/blacklist.h | 3 +
|
||||
multipath/multipath.conf.5 | 17 ++++--
|
||||
tests/blacklist.c | 110 +++++++++++++++++++++++++++++++++++++
|
||||
tests/test-lib.c | 2 +-
|
||||
5 files changed, 155 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/blacklist.c b/libmultipath/blacklist.c
|
||||
index 04d3adb9..0c58aa32 100644
|
||||
--- a/libmultipath/blacklist.c
|
||||
+++ b/libmultipath/blacklist.c
|
||||
@@ -15,9 +15,24 @@
|
||||
#include "structs_vec.h"
|
||||
#include "print.h"
|
||||
|
||||
+char *check_invert(char *str, bool *invert)
|
||||
+{
|
||||
+ if (str[0] == '!') {
|
||||
+ *invert = true;
|
||||
+ return str + 1;
|
||||
+ }
|
||||
+ if (str[0] == '\\' && str[1] == '!') {
|
||||
+ *invert = false;
|
||||
+ return str + 1;
|
||||
+ }
|
||||
+ *invert = false;
|
||||
+ return str;
|
||||
+}
|
||||
+
|
||||
int store_ble(vector blist, char * str, int origin)
|
||||
{
|
||||
struct blentry * ble;
|
||||
+ char *regex_str;
|
||||
|
||||
if (!str)
|
||||
return 0;
|
||||
@@ -30,7 +45,8 @@ int store_ble(vector blist, char * str, int origin)
|
||||
if (!ble)
|
||||
goto out;
|
||||
|
||||
- if (regcomp(&ble->regex, str, REG_EXTENDED|REG_NOSUB))
|
||||
+ regex_str = check_invert(str, &ble->invert);
|
||||
+ if (regcomp(&ble->regex, regex_str, REG_EXTENDED|REG_NOSUB))
|
||||
goto out1;
|
||||
|
||||
if (!vector_alloc_slot(blist))
|
||||
@@ -66,6 +82,7 @@ int alloc_ble_device(vector blist)
|
||||
int set_ble_device(vector blist, char * vendor, char * product, int origin)
|
||||
{
|
||||
struct blentry_device * ble;
|
||||
+ char *regex_str;
|
||||
|
||||
if (!blist)
|
||||
return 1;
|
||||
@@ -76,7 +93,8 @@ int set_ble_device(vector blist, char * vendor, char * product, int origin)
|
||||
return 1;
|
||||
|
||||
if (vendor) {
|
||||
- if (regcomp(&ble->vendor_reg, vendor,
|
||||
+ regex_str = check_invert(vendor, &ble->vendor_invert);
|
||||
+ if (regcomp(&ble->vendor_reg, regex_str,
|
||||
REG_EXTENDED|REG_NOSUB)) {
|
||||
FREE(vendor);
|
||||
if (product)
|
||||
@@ -86,7 +104,8 @@ int set_ble_device(vector blist, char * vendor, char * product, int origin)
|
||||
ble->vendor = vendor;
|
||||
}
|
||||
if (product) {
|
||||
- if (regcomp(&ble->product_reg, product,
|
||||
+ regex_str = check_invert(product, &ble->product_invert);
|
||||
+ if (regcomp(&ble->product_reg, regex_str,
|
||||
REG_EXTENDED|REG_NOSUB)) {
|
||||
FREE(product);
|
||||
if (vendor) {
|
||||
@@ -108,7 +127,7 @@ match_reglist (vector blist, const char * str)
|
||||
struct blentry * ble;
|
||||
|
||||
vector_foreach_slot (blist, ble, i) {
|
||||
- if (!regexec(&ble->regex, str, 0, NULL, 0))
|
||||
+ if (!!regexec(&ble->regex, str, 0, NULL, 0) == ble->invert)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -125,9 +144,11 @@ match_reglist_device (const struct _vector *blist, const char * vendor,
|
||||
if (!ble->vendor && !ble->product)
|
||||
continue;
|
||||
if ((!ble->vendor ||
|
||||
- !regexec(&ble->vendor_reg, vendor, 0, NULL, 0)) &&
|
||||
+ !!regexec(&ble->vendor_reg, vendor, 0, NULL, 0) ==
|
||||
+ ble->vendor_invert) &&
|
||||
(!ble->product ||
|
||||
- !regexec(&ble->product_reg, product, 0, NULL, 0)))
|
||||
+ !!regexec(&ble->product_reg, product, 0, NULL, 0) ==
|
||||
+ ble->product_invert))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -160,13 +181,7 @@ setup_default_blist (struct config * conf)
|
||||
char * str;
|
||||
int i;
|
||||
|
||||
- str = STRDUP("^(ram|zram|raw|loop|fd|md|dm-|sr|scd|st|dcssblk)[0-9]");
|
||||
- if (!str)
|
||||
- return 1;
|
||||
- if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
|
||||
- return 1;
|
||||
-
|
||||
- str = STRDUP("^(td|hd|vd)[a-z]");
|
||||
+ str = STRDUP("!^(sd[a-z]|dasd[a-z]|nvme[0-9])");
|
||||
if (!str)
|
||||
return 1;
|
||||
if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
|
||||
diff --git a/libmultipath/blacklist.h b/libmultipath/blacklist.h
|
||||
index 2d721f60..4305857d 100644
|
||||
--- a/libmultipath/blacklist.h
|
||||
+++ b/libmultipath/blacklist.h
|
||||
@@ -20,6 +20,7 @@
|
||||
struct blentry {
|
||||
char * str;
|
||||
regex_t regex;
|
||||
+ bool invert;
|
||||
int origin;
|
||||
};
|
||||
|
||||
@@ -28,6 +29,8 @@ struct blentry_device {
|
||||
char * product;
|
||||
regex_t vendor_reg;
|
||||
regex_t product_reg;
|
||||
+ bool vendor_invert;
|
||||
+ bool product_invert;
|
||||
int origin;
|
||||
};
|
||||
|
||||
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
|
||||
index 3455b1cc..6dc26f10 100644
|
||||
--- a/multipath/multipath.conf.5
|
||||
+++ b/multipath/multipath.conf.5
|
||||
@@ -1248,6 +1248,16 @@ being handled by multipath-tools.
|
||||
.LP
|
||||
.
|
||||
.
|
||||
+In the \fIblacklist\fR and \fIblacklist_exceptions\fR sections, starting a
|
||||
+quoted value with an exclamation mark \fB"!"\fR will invert the matching
|
||||
+of the rest of the regular expression. For instance, \fB"!^sd[a-z]"\fR will
|
||||
+match all values that do not start with \fB"sd[a-z]"\fR. The exclamation mark
|
||||
+can be escaped \fB"\\!"\fR to match a literal \fB!\fR at the start of a
|
||||
+regular expression. \fBNote:\fR The exclamation mark must be inside quotes,
|
||||
+otherwise it will be treated as starting a comment.
|
||||
+.LP
|
||||
+.
|
||||
+.
|
||||
The \fIblacklist_exceptions\fR section is used to revert the actions of the
|
||||
\fIblacklist\fR section. This allows one to selectively include ("whitelist") devices which
|
||||
would normally be excluded via the \fIblacklist\fR section. A common usage is
|
||||
@@ -1264,10 +1274,9 @@ unless explicitly stated.
|
||||
Regular expression matching the device nodes to be excluded/included.
|
||||
.RS
|
||||
.PP
|
||||
-The default \fIblacklist\fR consists of the regular expressions
|
||||
-"^(ram|zram|raw|loop|fd|md|dm-|sr|scd|st|dcssblk)[0-9]" and
|
||||
-"^(td|hd|vd)[a-z]". This causes virtual devices, non-disk devices, and some other
|
||||
-device types to be excluded from multipath handling by default.
|
||||
+The default \fIblacklist\fR consists of the regular expression
|
||||
+\fB"!^(sd[a-z]|dasd[a-z]|nvme[0-9])"\fR. This causes all device types other
|
||||
+than scsi, dasd, and nvme to be excluded from multipath handling by default.
|
||||
.RE
|
||||
.TP
|
||||
.B wwid
|
||||
diff --git a/tests/blacklist.c b/tests/blacklist.c
|
||||
index cc8a9a4a..d20e97af 100644
|
||||
--- a/tests/blacklist.c
|
||||
+++ b/tests/blacklist.c
|
||||
@@ -60,20 +60,46 @@ __wrap_udev_list_entry_get_name(struct udev_list_entry *list_entry)
|
||||
return *(const char **)list_entry;
|
||||
}
|
||||
|
||||
+vector elist_property_default;
|
||||
+vector blist_devnode_default;
|
||||
vector blist_devnode_sdb;
|
||||
+vector blist_devnode_sdb_inv;
|
||||
vector blist_all;
|
||||
vector blist_device_foo_bar;
|
||||
+vector blist_device_foo_inv_bar;
|
||||
+vector blist_device_foo_bar_inv;
|
||||
vector blist_device_all;
|
||||
vector blist_wwid_xyzzy;
|
||||
+vector blist_wwid_xyzzy_inv;
|
||||
vector blist_protocol_fcp;
|
||||
+vector blist_protocol_fcp_inv;
|
||||
vector blist_property_wwn;
|
||||
+vector blist_property_wwn_inv;
|
||||
|
||||
static int setup(void **state)
|
||||
{
|
||||
+ struct config conf;
|
||||
+
|
||||
+ memset(&conf, 0, sizeof(conf));
|
||||
+ conf.blist_devnode = vector_alloc();
|
||||
+ if (!conf.blist_devnode)
|
||||
+ return -1;
|
||||
+ conf.elist_property = vector_alloc();
|
||||
+ if (!conf.elist_property)
|
||||
+ return -1;
|
||||
+ if (setup_default_blist(&conf) != 0)
|
||||
+ return -1;
|
||||
+ elist_property_default = conf.elist_property;
|
||||
+ blist_devnode_default = conf.blist_devnode;
|
||||
+
|
||||
blist_devnode_sdb = vector_alloc();
|
||||
if (!blist_devnode_sdb ||
|
||||
store_ble(blist_devnode_sdb, strdup("sdb"), ORIGIN_CONFIG))
|
||||
return -1;
|
||||
+ blist_devnode_sdb_inv = vector_alloc();
|
||||
+ if (!blist_devnode_sdb_inv ||
|
||||
+ store_ble(blist_devnode_sdb_inv, strdup("!sdb"), ORIGIN_CONFIG))
|
||||
+ return -1;
|
||||
|
||||
blist_all = vector_alloc();
|
||||
if (!blist_all || store_ble(blist_all, strdup(".*"), ORIGIN_CONFIG))
|
||||
@@ -84,6 +110,18 @@ static int setup(void **state)
|
||||
set_ble_device(blist_device_foo_bar, strdup("foo"), strdup("bar"),
|
||||
ORIGIN_CONFIG))
|
||||
return -1;
|
||||
+ blist_device_foo_inv_bar = vector_alloc();
|
||||
+ if (!blist_device_foo_inv_bar ||
|
||||
+ alloc_ble_device(blist_device_foo_inv_bar) ||
|
||||
+ set_ble_device(blist_device_foo_inv_bar, strdup("!foo"),
|
||||
+ strdup("bar"), ORIGIN_CONFIG))
|
||||
+ return -1;
|
||||
+ blist_device_foo_bar_inv = vector_alloc();
|
||||
+ if (!blist_device_foo_bar_inv ||
|
||||
+ alloc_ble_device(blist_device_foo_bar_inv) ||
|
||||
+ set_ble_device(blist_device_foo_bar_inv, strdup("foo"),
|
||||
+ strdup("!bar"), ORIGIN_CONFIG))
|
||||
+ return -1;
|
||||
|
||||
blist_device_all = vector_alloc();
|
||||
if (!blist_device_all || alloc_ble_device(blist_device_all) ||
|
||||
@@ -95,29 +133,50 @@ static int setup(void **state)
|
||||
if (!blist_wwid_xyzzy ||
|
||||
store_ble(blist_wwid_xyzzy, strdup("xyzzy"), ORIGIN_CONFIG))
|
||||
return -1;
|
||||
+ blist_wwid_xyzzy_inv = vector_alloc();
|
||||
+ if (!blist_wwid_xyzzy_inv ||
|
||||
+ store_ble(blist_wwid_xyzzy_inv, strdup("!xyzzy"), ORIGIN_CONFIG))
|
||||
+ return -1;
|
||||
|
||||
blist_protocol_fcp = vector_alloc();
|
||||
if (!blist_protocol_fcp ||
|
||||
store_ble(blist_protocol_fcp, strdup("scsi:fcp"), ORIGIN_CONFIG))
|
||||
return -1;
|
||||
+ blist_protocol_fcp_inv = vector_alloc();
|
||||
+ if (!blist_protocol_fcp_inv ||
|
||||
+ store_ble(blist_protocol_fcp_inv, strdup("!scsi:fcp"),
|
||||
+ ORIGIN_CONFIG))
|
||||
+ return -1;
|
||||
|
||||
blist_property_wwn = vector_alloc();
|
||||
if (!blist_property_wwn ||
|
||||
store_ble(blist_property_wwn, strdup("ID_WWN"), ORIGIN_CONFIG))
|
||||
return -1;
|
||||
+ blist_property_wwn_inv = vector_alloc();
|
||||
+ if (!blist_property_wwn_inv ||
|
||||
+ store_ble(blist_property_wwn_inv, strdup("!ID_WWN"), ORIGIN_CONFIG))
|
||||
+ return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int teardown(void **state)
|
||||
{
|
||||
+ free_blacklist(elist_property_default);
|
||||
+ free_blacklist(blist_devnode_default);
|
||||
free_blacklist(blist_devnode_sdb);
|
||||
+ free_blacklist(blist_devnode_sdb_inv);
|
||||
free_blacklist(blist_all);
|
||||
free_blacklist_device(blist_device_foo_bar);
|
||||
+ free_blacklist_device(blist_device_foo_inv_bar);
|
||||
+ free_blacklist_device(blist_device_foo_bar_inv);
|
||||
free_blacklist_device(blist_device_all);
|
||||
free_blacklist(blist_wwid_xyzzy);
|
||||
+ free_blacklist(blist_wwid_xyzzy_inv);
|
||||
free_blacklist(blist_protocol_fcp);
|
||||
+ free_blacklist(blist_protocol_fcp_inv);
|
||||
free_blacklist(blist_property_wwn);
|
||||
+ free_blacklist(blist_property_wwn_inv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -141,6 +200,11 @@ static void test_devnode_blacklist(void **state)
|
||||
expect_condlog(3, "sdb: device node name blacklisted\n");
|
||||
assert_int_equal(filter_devnode(blist_devnode_sdb, NULL, "sdb"),
|
||||
MATCH_DEVNODE_BLIST);
|
||||
+ assert_int_equal(filter_devnode(blist_devnode_sdb_inv, NULL, "sdb"),
|
||||
+ MATCH_NOTHING);
|
||||
+ expect_condlog(3, "sdc: device node name blacklisted\n");
|
||||
+ assert_int_equal(filter_devnode(blist_devnode_sdb_inv, NULL, "sdc"),
|
||||
+ MATCH_DEVNODE_BLIST);
|
||||
}
|
||||
|
||||
static void test_devnode_whitelist(void **state)
|
||||
@@ -159,12 +223,39 @@ static void test_devnode_missing(void **state)
|
||||
MATCH_NOTHING);
|
||||
}
|
||||
|
||||
+static void test_devnode_default(void **state)
|
||||
+{
|
||||
+ assert_int_equal(filter_devnode(blist_devnode_default, NULL, "sdaa"),
|
||||
+ MATCH_NOTHING);
|
||||
+ assert_int_equal(filter_devnode(blist_devnode_default, NULL, "nvme0n1"),
|
||||
+ MATCH_NOTHING);
|
||||
+ assert_int_equal(filter_devnode(blist_devnode_default, NULL, "dasda"),
|
||||
+ MATCH_NOTHING);
|
||||
+ expect_condlog(3, "hda: device node name blacklisted\n");
|
||||
+ assert_int_equal(filter_devnode(blist_devnode_default, NULL, "hda"),
|
||||
+ MATCH_DEVNODE_BLIST);
|
||||
+}
|
||||
+
|
||||
static void test_device_blacklist(void **state)
|
||||
{
|
||||
expect_condlog(3, "sdb: (foo:bar) vendor/product blacklisted\n");
|
||||
assert_int_equal(filter_device(blist_device_foo_bar, NULL, "foo",
|
||||
"bar", "sdb"),
|
||||
MATCH_DEVICE_BLIST);
|
||||
+ assert_int_equal(filter_device(blist_device_foo_inv_bar, NULL, "foo",
|
||||
+ "bar", "sdb"),
|
||||
+ MATCH_NOTHING);
|
||||
+ assert_int_equal(filter_device(blist_device_foo_bar_inv, NULL, "foo",
|
||||
+ "bar", "sdb"),
|
||||
+ MATCH_NOTHING);
|
||||
+ expect_condlog(3, "sdb: (baz:bar) vendor/product blacklisted\n");
|
||||
+ assert_int_equal(filter_device(blist_device_foo_inv_bar, NULL, "baz",
|
||||
+ "bar", "sdb"),
|
||||
+ MATCH_DEVICE_BLIST);
|
||||
+ expect_condlog(3, "sdb: (foo:baz) vendor/product blacklisted\n");
|
||||
+ assert_int_equal(filter_device(blist_device_foo_bar_inv, NULL, "foo",
|
||||
+ "baz", "sdb"),
|
||||
+ MATCH_DEVICE_BLIST);
|
||||
}
|
||||
|
||||
static void test_device_whitelist(void **state)
|
||||
@@ -191,6 +282,11 @@ static void test_wwid_blacklist(void **state)
|
||||
expect_condlog(3, "sdb: wwid xyzzy blacklisted\n");
|
||||
assert_int_equal(filter_wwid(blist_wwid_xyzzy, NULL, "xyzzy", "sdb"),
|
||||
MATCH_WWID_BLIST);
|
||||
+ assert_int_equal(filter_wwid(blist_wwid_xyzzy_inv, NULL, "xyzzy",
|
||||
+ "sdb"), MATCH_NOTHING);
|
||||
+ expect_condlog(3, "sdb: wwid plugh blacklisted\n");
|
||||
+ assert_int_equal(filter_wwid(blist_wwid_xyzzy_inv, NULL, "plugh",
|
||||
+ "sdb"), MATCH_WWID_BLIST);
|
||||
}
|
||||
|
||||
static void test_wwid_whitelist(void **state)
|
||||
@@ -218,6 +314,12 @@ static void test_protocol_blacklist(void **state)
|
||||
expect_condlog(3, "sdb: protocol scsi:fcp blacklisted\n");
|
||||
assert_int_equal(filter_protocol(blist_protocol_fcp, NULL, &pp),
|
||||
MATCH_PROTOCOL_BLIST);
|
||||
+ assert_int_equal(filter_protocol(blist_protocol_fcp_inv, NULL, &pp),
|
||||
+ MATCH_NOTHING);
|
||||
+ pp.sg_id.proto_id = SCSI_PROTOCOL_ATA;
|
||||
+ expect_condlog(3, "sdb: protocol scsi:ata blacklisted\n");
|
||||
+ assert_int_equal(filter_protocol(blist_protocol_fcp_inv, NULL, &pp),
|
||||
+ MATCH_PROTOCOL_BLIST);
|
||||
}
|
||||
|
||||
static void test_protocol_whitelist(void **state)
|
||||
@@ -245,10 +347,17 @@ static void test_protocol_missing(void **state)
|
||||
static void test_property_blacklist(void **state)
|
||||
{
|
||||
static struct udev_device udev = { "sdb", { "ID_FOO", "ID_WWN", "ID_BAR", NULL } };
|
||||
+ static struct udev_device udev_inv = { "sdb", { "ID_WWN", NULL } };
|
||||
conf.blist_property = blist_property_wwn;
|
||||
expect_condlog(3, "sdb: udev property ID_WWN blacklisted\n");
|
||||
assert_int_equal(filter_property(&conf, &udev, 3, "ID_SERIAL"),
|
||||
MATCH_PROPERTY_BLIST);
|
||||
+ conf.blist_property = blist_property_wwn_inv;
|
||||
+ expect_condlog(3, "sdb: udev property ID_FOO blacklisted\n");
|
||||
+ assert_int_equal(filter_property(&conf, &udev, 3, "ID_SERIAL"),
|
||||
+ MATCH_PROPERTY_BLIST);
|
||||
+ assert_int_equal(filter_property(&conf, &udev_inv, 3, "ID_SERIAL"),
|
||||
+ MATCH_NOTHING);
|
||||
}
|
||||
|
||||
/* the property check works different in that you check all the property
|
||||
@@ -482,6 +591,7 @@ int test_blacklist(void)
|
||||
cmocka_unit_test(test_devnode_blacklist),
|
||||
cmocka_unit_test(test_devnode_whitelist),
|
||||
cmocka_unit_test(test_devnode_missing),
|
||||
+ cmocka_unit_test(test_devnode_default),
|
||||
cmocka_unit_test(test_device_blacklist),
|
||||
cmocka_unit_test(test_device_whitelist),
|
||||
cmocka_unit_test(test_device_missing),
|
||||
diff --git a/tests/test-lib.c b/tests/test-lib.c
|
||||
index 59275163..08ff2d8d 100644
|
||||
--- a/tests/test-lib.c
|
||||
+++ b/tests/test-lib.c
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "test-lib.h"
|
||||
|
||||
const int default_mask = (DI_SYSFS|DI_BLACKLIST|DI_WWID|DI_CHECKER|DI_PRIO);
|
||||
-const char default_devnode[] = "sdTEST";
|
||||
+const char default_devnode[] = "sdxTEST";
|
||||
const char default_wwid[] = "TEST-WWID";
|
||||
/* default_wwid should be a substring of default_wwid_1! */
|
||||
const char default_wwid_1[] = "TEST-WWID-1";
|
||||
--
|
||||
2.17.2
|
||||
|
@ -1,35 +1,39 @@
|
||||
Summary: Tools to manage multipath devices using device-mapper
|
||||
Name: device-mapper-multipath
|
||||
Version: 0.8.3
|
||||
Release: 3%{?dist}
|
||||
Version: 0.8.4
|
||||
Release: 2%{?dist}
|
||||
License: GPLv2
|
||||
Group: System Environment/Base
|
||||
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.8.3;sf=tgz" -o multipath-tools-0.8.3.tgz
|
||||
Source0: multipath-tools-0.8.3.tgz
|
||||
#curl "https://git.opensvc.com/?p=multipath-tools/.git;a=snapshot;h=refs/tags/0.8.4;sf=tgz" -o multipath-tools-0.8.4.tgz
|
||||
Source0: multipath-tools-0.8.4.tgz
|
||||
Source1: multipath.conf
|
||||
Patch00001: 0001-multipathd-warn-when-configuration-has-been-changed.patch
|
||||
Patch00002: 0002-libmultipath-fix-leak-in-foreign-code.patch
|
||||
Patch00003: 0003-Fix-leak-in-mpathpersist.patch
|
||||
Patch00004: 0004-libmultipath-remove-unused-path-prio_args.patch
|
||||
Patch00005: 0005-libmultipath-constify-get_unaligned_be.patch
|
||||
Patch00006: 0006-libmultipath-add-missing-hwe-mpe-variable-merges.patch
|
||||
Patch00007: 0007-libmultipath-fix-sgio_get_vpd-looping.patch
|
||||
Patch00008: 0008-libmultipath-add-vend_id-to-get_vpd_sgio.patch
|
||||
Patch00009: 0009-libmultipath-add-code-to-get-vendor-specific-vpd-dat.patch
|
||||
Patch00010: 0010-RH-fixup-udev-rules-for-redhat.patch
|
||||
Patch00011: 0011-RH-Remove-the-property-blacklist-exception-builtin.patch
|
||||
Patch00012: 0012-RH-don-t-start-without-a-config-file.patch
|
||||
Patch00013: 0013-RH-use-rpm-optflags-if-present.patch
|
||||
Patch00014: 0014-RH-add-mpathconf.patch
|
||||
Patch00015: 0015-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
|
||||
Patch00016: 0016-RH-warn-on-invalid-regex-instead-of-failing.patch
|
||||
Patch00017: 0017-RH-reset-default-find_mutipaths-value-to-off.patch
|
||||
Patch00018: 0018-RH-Fix-nvme-compilation-warning.patch
|
||||
Patch00019: 0019-RH-attempt-to-get-ANA-info-via-sysfs-first.patch
|
||||
Patch00001: 0001-libmultipath-assign-variable-to-make-gcc-happy.patch
|
||||
Patch00002: 0002-libmutipath-don-t-close-fd-on-dm_lib_release.patch
|
||||
Patch00003: 0003-libmultipath-allow-force-reload-with-no-active-paths.patch
|
||||
Patch00004: 0004-libmpathpersist-depend-on-libmultipath.patch
|
||||
Patch00005: 0005-multipath-tools-Makefile-more-dependency-fixes-for-p.patch
|
||||
Patch00006: 0006-multipath-tools-Makefile.inc-set-Wno-error-clobbered.patch
|
||||
Patch00007: 0007-libmultipath-discovery.c-use-z-qualifier-for-size_t.patch
|
||||
Patch00008: 0008-libmultipath-eliminate-more-signed-unsigned-comparis.patch
|
||||
Patch00009: 0009-libmultipath-set_uint-fix-parsing-for-32bit.patch
|
||||
Patch00010: 0010-multipath-tools-Makefile-add-install-dependency.patch
|
||||
Patch00011: 0011-RH-fixup-udev-rules-for-redhat.patch
|
||||
Patch00012: 0012-RH-Remove-the-property-blacklist-exception-builtin.patch
|
||||
Patch00013: 0013-RH-don-t-start-without-a-config-file.patch
|
||||
Patch00014: 0014-RH-use-rpm-optflags-if-present.patch
|
||||
Patch00015: 0015-RH-add-mpathconf.patch
|
||||
Patch00016: 0016-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
|
||||
Patch00017: 0017-RH-warn-on-invalid-regex-instead-of-failing.patch
|
||||
Patch00018: 0018-RH-reset-default-find_mutipaths-value-to-off.patch
|
||||
Patch00019: 0019-RH-Fix-nvme-compilation-warning.patch
|
||||
Patch00020: 0020-RH-attempt-to-get-ANA-info-via-sysfs-first.patch
|
||||
Patch00021: 0021-libmultipath-remove-_blacklist_exceptions-functions.patch
|
||||
Patch00022: 0022-libmultipath-fix-parser-issue-with-comments-in-strin.patch
|
||||
Patch00023: 0023-libmultipath-invert-regexes-that-start-with-exclamat.patch
|
||||
|
||||
# runtime
|
||||
Requires: %{name}-libs = %{version}-%{release}
|
||||
@ -107,7 +111,7 @@ This package contains the files needed to develop applications that use
|
||||
device-mapper-multipath's libdmmp C API library
|
||||
|
||||
%prep
|
||||
%autosetup -n multipath-tools-0.8.3 -p1
|
||||
%autosetup -n multipath-tools-0.8.4 -p1
|
||||
cp %{SOURCE1} .
|
||||
|
||||
%build
|
||||
@ -231,6 +235,35 @@ fi
|
||||
%{_pkgconfdir}/libdmmp.pc
|
||||
|
||||
%changelog
|
||||
* Tue Jun 9 2020 Benjamin Marzinski <bmarzins@redhat.com> 0.8.4-2
|
||||
- Add 0021-libmultipath-remove-_blacklist_exceptions-functions.patch
|
||||
- Add 0022-libmultipath-fix-parser-issue-with-comments-in-strin.patch
|
||||
- Add 0023-libmultipath-invert-regexes-that-start-with-exclamat.patch
|
||||
* This commit also changes the default devnode blacklist to
|
||||
blacklist all devices except scsi, dasd, and nvme.
|
||||
- Resolves: bz #1828180
|
||||
|
||||
* Wed May 27 2020 Benjamin Marzinski <bmarzins@redhat.com> 0.8.4-1
|
||||
- Update Source to upstream version 0.8.4
|
||||
* This version includes the fixes for bz #1768894 & #1821214
|
||||
* Previous patches 0001-0009 are included in this version
|
||||
- Rename files
|
||||
* Previous patches 0010-0019 are now 0011-0020
|
||||
- Add 0001-libmultipath-assign-variable-to-make-gcc-happy.patch
|
||||
- Add 0002-libmutipath-don-t-close-fd-on-dm_lib_release.patch
|
||||
- Add 0003-libmultipath-allow-force-reload-with-no-active-paths.patch
|
||||
* make multipath and multipathd reload maps with no active paths
|
||||
(bz #1814858)
|
||||
- Add 0004-libmpathpersist-depend-on-libmultipath.patch
|
||||
- Add 0005-multipath-tools-Makefile-more-dependency-fixes-for-p.patch
|
||||
- Add 0006-multipath-tools-Makefile.inc-set-Wno-error-clobbered.patch
|
||||
- Add 0007-libmultipath-discovery.c-use-z-qualifier-for-size_t.patch
|
||||
- Add 0008-libmultipath-eliminate-more-signed-unsigned-comparis.patch
|
||||
- Add 0009-libmultipath-set_uint-fix-parsing-for-32bit.patch
|
||||
- Add 0010-multipath-tools-Makefile-add-install-dependency.patch
|
||||
* The above 10 patches have been submitted upstream
|
||||
- Resolves: bz #1768894, #1814858, #1821214
|
||||
|
||||
* Fri Nov 8 2019 Benjamin Marzinski <bmarzins@redhat.com> 0.8.3-3
|
||||
- Rename files
|
||||
* Previous patches 0004-0013 are now 0010-0019
|
||||
|
Loading…
Reference in New Issue
Block a user