device-mapper-multipath-0.8.4-7

- Add 0073-libmultipath-util-constify-function-arguments.patch
- Add 0074-libmultipath-constify-file-argument-in-config-parser.patch
- Add 0075-libmultipath-provide-defaults-for-get-put-_multipath.patch
- Add 0076-libmpathpersist-allow-using-libmultipath-get-put-_mu.patch
- Add 0077-multipath-use-get_put-_multipath_config-from-libmult.patch
- Add 0078-mpathpersist-use-get-put-_multipath_config-from-libm.patch
- Add 0079-libmultipath-add-udev-and-logsink-symbols.patch
- Add 0080-multipath-remove-logsink-and-udev.patch
- Add 0081-libmpathpersist-call-libmultipath_-init-exit.patch
- Add 0082-mpathpersist-remove-logsink-and-udev.patch
- Add 0083-multipathd-remove-logsink-and-udev.patch
  * Pull in upsteam library changes
- Add 0084-libmpathvalid-use-default-_multipath_config-udev-and.patch
- Add 0085-Revert-libmultipath-add-ignore_udev_uid-option.patch
- Add 0086-libmultipath-change-log-level-for-null-uid_attribute.patch
- Add 0087-libmultipath-orphan_paths-avoid-BUG-message.patch
  * update libmpathvalid to use upstream library changes. changes
    submitted upstream
This commit is contained in:
Benjamin Marzinski 2020-09-27 00:56:23 -05:00
parent c8438866fb
commit 2cf40b2f98
16 changed files with 1536 additions and 1 deletions

View File

@ -0,0 +1,111 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 8 Jul 2020 09:23:20 +0200
Subject: [PATCH] libmultipath: util: constify function arguments
Use "const" for function arguments where possible.
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/dmparser.c | 2 +-
libmultipath/util.c | 12 ++++++------
libmultipath/util.h | 10 +++++-----
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
index b856a07f..27581cde 100644
--- a/libmultipath/dmparser.c
+++ b/libmultipath/dmparser.c
@@ -18,7 +18,7 @@
#define WORD_SIZE 64
static int
-merge_words(char **dst, char *word)
+merge_words(char **dst, const char *word)
{
char * p = *dst;
int len, dstlen;
diff --git a/libmultipath/util.c b/libmultipath/util.c
index 51c38c87..67e7a42f 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -52,7 +52,7 @@ basenamecpy (const char *src, char *dst, size_t size)
}
int
-filepresent (char * run) {
+filepresent (const char *run) {
struct stat buf;
if(!stat(run, &buf))
@@ -60,7 +60,7 @@ filepresent (char * run) {
return 0;
}
-char *get_next_string(char **temp, char *split_char)
+char *get_next_string(char **temp, const char *split_char)
{
char *token = NULL;
token = strsep(temp, split_char);
@@ -70,9 +70,9 @@ char *get_next_string(char **temp, char *split_char)
}
int
-get_word (char * sentence, char ** word)
+get_word (const char *sentence, char **word)
{
- char * p;
+ const char *p;
int len;
int skip = 0;
@@ -381,7 +381,7 @@ int get_linux_version_code(void)
return _linux_version_code;
}
-int parse_prkey(char *ptr, uint64_t *prkey)
+int parse_prkey(const char *ptr, uint64_t *prkey)
{
if (!ptr)
return 1;
@@ -398,7 +398,7 @@ int parse_prkey(char *ptr, uint64_t *prkey)
return 0;
}
-int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags)
+int parse_prkey_flags(const char *ptr, uint64_t *prkey, uint8_t *flags)
{
char *flagstr;
diff --git a/libmultipath/util.h b/libmultipath/util.h
index 56bd78c7..c19c5ac3 100644
--- a/libmultipath/util.h
+++ b/libmultipath/util.h
@@ -9,9 +9,9 @@
size_t strchop(char *);
int basenamecpy (const char *src, char *dst, size_t size);
-int filepresent (char * run);
-char *get_next_string(char **temp, char *split_char);
-int get_word (char * sentence, char ** word);
+int filepresent (const char *run);
+char *get_next_string(char **temp, const char *split_char);
+int get_word (const char * sentence, char ** word);
size_t strlcpy(char *dst, const char *src, size_t size);
size_t strlcat(char *dst, const char *src, size_t size);
int devt2devname (char *, int, char *);
@@ -20,8 +20,8 @@ char *convert_dev(char *dev, int is_path_device);
void setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached);
int systemd_service_enabled(const char *dev);
int get_linux_version_code(void);
-int parse_prkey(char *ptr, uint64_t *prkey);
-int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags);
+int parse_prkey(const char *ptr, uint64_t *prkey);
+int parse_prkey_flags(const char *ptr, uint64_t *prkey, uint8_t *flags);
int safe_write(int fd, const void *buf, size_t count);
void set_max_fds(rlim_t max_fds);
--
2.17.2

View File

@ -0,0 +1,99 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 24 Sep 2020 15:37:07 +0200
Subject: [PATCH] libmultipath: constify file argument in config parser
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/config.c | 3 +--
libmultipath/config.h | 2 +-
libmultipath/parser.c | 9 +++++----
libmultipath/parser.h | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index a253a936..1818f8b9 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -718,8 +718,7 @@ static void set_max_checkint_from_watchdog(struct config *conf)
}
#endif
-struct config *
-load_config (char * file)
+struct config *load_config(const char *file)
{
struct config *conf = alloc_config();
diff --git a/libmultipath/config.h b/libmultipath/config.h
index c7a73fba..78375f2f 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -253,7 +253,7 @@ void free_mptable (vector mptable);
int store_hwe (vector hwtable, struct hwentry *);
-struct config *load_config (char * file);
+struct config *load_config (const char *file);
struct config * alloc_config (void);
void free_config (struct config * conf);
extern struct config *get_multipath_config(void);
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
index a7285a35..d150e7b2 100644
--- a/libmultipath/parser.c
+++ b/libmultipath/parser.c
@@ -400,7 +400,7 @@ set_regex_value(vector strvec)
/* non-recursive configuration stream handler */
static int kw_level = 0;
-int warn_on_duplicates(vector uniques, char *str, char *file)
+int warn_on_duplicates(vector uniques, char *str, const char *file)
{
char *tmp;
int i;
@@ -444,7 +444,7 @@ is_sublevel_keyword(char *str)
}
int
-validate_config_strvec(vector strvec, char *file)
+validate_config_strvec(vector strvec, const char *file)
{
char *str;
int i;
@@ -507,7 +507,8 @@ validate_config_strvec(vector strvec, char *file)
}
static int
-process_stream(struct config *conf, FILE *stream, vector keywords, char *file)
+process_stream(struct config *conf, FILE *stream, vector keywords,
+ const char *file)
{
int i;
int r = 0, t;
@@ -592,7 +593,7 @@ out:
/* Data initialization */
int
-process_file(struct config *conf, char *file)
+process_file(struct config *conf, const char *file)
{
int r;
FILE *stream;
diff --git a/libmultipath/parser.h b/libmultipath/parser.h
index b7917052..b385fb9e 100644
--- a/libmultipath/parser.h
+++ b/libmultipath/parser.h
@@ -78,7 +78,7 @@ extern void free_keywords(vector keywords);
extern vector alloc_strvec(char *string);
extern void *set_value(vector strvec);
extern void *set_regex_value(vector strvec);
-extern int process_file(struct config *conf, char *conf_file);
+extern int process_file(struct config *conf, const char *conf_file);
extern struct keyword * find_keyword(vector keywords, vector v, char * name);
int snprint_keyword(char *buff, int len, char *fmt, struct keyword *kw,
const void *data);
--
2.17.2

View File

@ -0,0 +1,182 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 24 Sep 2020 15:37:08 +0200
Subject: [PATCH] libmultipath: provide defaults for {get,put}_multipath_config
Add an implementation of get_multipath_config() and put_multipath_config()
to libmultipath. The linker's symbol lookup rules will make sure that
applications can override these functions if they need to. Defining
these functions in libmultipath avoids the need to provide stubs
for these functions in every appliation linking to libmultipath.
libmultipath's internal functions simply refer to a static "struct config".
It must be initialized with init_config() rather than load_config(),
which always allocates a new struct for backward compatibility, and must
be teared down using uninit_config().
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/config.c | 72 +++++++++++++++++++++++++++++++++++++------
libmultipath/config.h | 21 +++++++++++--
2 files changed, 80 insertions(+), 13 deletions(-)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index 1818f8b9..422e923d 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -28,6 +28,23 @@
#include "propsel.h"
#include "version.h"
+static struct config __internal_config;
+struct config *libmp_get_multipath_config(void)
+{
+ return &__internal_config;
+}
+
+struct config *get_multipath_config(void)
+ __attribute__((weak, alias("libmp_get_multipath_config")));
+
+void libmp_put_multipath_config(void *conf __attribute__((unused)))
+{
+ /* empty */
+}
+
+void put_multipath_config(void *conf)
+ __attribute__((weak, alias("libmp_put_multipath_config")));
+
static int
hwe_strmatch (const struct hwentry *hwe1, const struct hwentry *hwe2)
{
@@ -575,17 +592,15 @@ restart:
return;
}
-struct config *
-alloc_config (void)
+static struct config *alloc_config (void)
{
return (struct config *)MALLOC(sizeof(struct config));
}
-void
-free_config (struct config * conf)
+static void _uninit_config(struct config *conf)
{
if (!conf)
- return;
+ conf = &__internal_config;
if (conf->multipath_dir)
FREE(conf->multipath_dir);
@@ -649,7 +664,27 @@ free_config (struct config * conf)
free_hwtable(conf->hwtable);
free_hwe(conf->overrides);
free_keywords(conf->keywords);
- FREE(conf);
+
+ memset(conf, 0, sizeof(*conf));
+}
+
+void uninit_config(void)
+{
+ _uninit_config(&__internal_config);
+}
+
+void free_config(struct config *conf)
+{
+ if (!conf)
+ return;
+ else if (conf == &__internal_config) {
+ condlog(0, "ERROR: %s called for internal config. Use uninit_config() instead",
+ __func__);
+ return;
+ }
+
+ _uninit_config(conf);
+ free(conf);
}
/* if multipath fails to process the config directory, it should continue,
@@ -718,12 +753,29 @@ static void set_max_checkint_from_watchdog(struct config *conf)
}
#endif
+static int _init_config (const char *file, struct config *conf);
+
+int init_config(const char *file)
+{
+ return _init_config(file, &__internal_config);
+}
+
struct config *load_config(const char *file)
{
struct config *conf = alloc_config();
+ if (conf && !_init_config(file, conf))
+ return conf;
+
+ free(conf);
+ return NULL;
+}
+
+int _init_config (const char *file, struct config *conf)
+{
+
if (!conf)
- return NULL;
+ conf = &__internal_config;
/*
* internal defaults
@@ -911,10 +963,10 @@ struct config *load_config(const char *file)
!conf->wwids_file || !conf->prkeys_file)
goto out;
- return conf;
+ return 0;
out:
- free_config(conf);
- return NULL;
+ _uninit_config(conf);
+ return 1;
}
char *get_uid_attribute_by_attrs(struct config *conf,
diff --git a/libmultipath/config.h b/libmultipath/config.h
index 78375f2f..83d179ac 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -254,10 +254,25 @@ void free_mptable (vector mptable);
int store_hwe (vector hwtable, struct hwentry *);
struct config *load_config (const char *file);
-struct config * alloc_config (void);
void free_config (struct config * conf);
-extern struct config *get_multipath_config(void);
-extern void put_multipath_config(void *);
+int init_config(const char *file);
+void uninit_config(void);
+
+/*
+ * libmultipath provides default implementations of
+ * get_multipath_config() and put_multipath_config().
+ * Applications using these should use init_config(file, NULL)
+ * to load the configuration, rather than load_config(file).
+ * Likewise, uninit_config() should be used for teardown, but
+ * using free_config() for that is supported, too.
+ * Applications can define their own {get,put}_multipath_config()
+ * functions, which override the library-internal ones, but
+ * could still call libmp_{get,put}_multipath_config().
+ */
+struct config *libmp_get_multipath_config(void);
+struct config *get_multipath_config(void);
+void libmp_put_multipath_config(void *);
+void put_multipath_config(void *);
int parse_uid_attrs(char *uid_attrs, struct config *conf);
char *get_uid_attribute_by_attrs(struct config *conf,
--
2.17.2

View File

@ -0,0 +1,142 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 24 Sep 2020 15:37:09 +0200
Subject: [PATCH] libmpathpersist: allow using libmultipath
{get,put}_multipath_config
Provide an alternative init function libmpathpersist_init() which
avoids allocating a new struct config, simply using libmultipath's
internal implementation.
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathpersist/mpath_persist.c | 42 ++++++++++++++++++++++++++++-----
libmpathpersist/mpath_persist.h | 28 ++++++++++++++++++++++
2 files changed, 64 insertions(+), 6 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index a132f4e9..9dfc98cd 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -37,6 +37,27 @@
extern struct udev *udev;
+static void adapt_config(struct config *conf)
+{
+ conf->force_sync = 1;
+ set_max_fds(conf->max_fds);
+}
+
+int libmpathpersist_init(void)
+{
+ struct config *conf;
+ int rc = 0;
+
+ if (init_config(DEFAULT_CONFIGFILE)) {
+ condlog(0, "Failed to initialize multipath config.");
+ return 1;
+ }
+ conf = libmp_get_multipath_config();
+ adapt_config(conf);
+ libmp_put_multipath_config(conf);
+ return rc;
+}
+
struct config *
mpath_lib_init (void)
{
@@ -47,21 +68,30 @@ mpath_lib_init (void)
condlog(0, "Failed to initialize multipath config.");
return NULL;
}
- conf->force_sync = 1;
- set_max_fds(conf->max_fds);
-
+ adapt_config(conf);
return conf;
}
-int
-mpath_lib_exit (struct config *conf)
+static void libmpathpersist_cleanup(void)
{
dm_lib_release();
dm_lib_exit();
cleanup_prio();
cleanup_checkers();
+}
+
+int
+mpath_lib_exit (struct config *conf)
+{
+ libmpathpersist_cleanup();
free_config(conf);
- conf = NULL;
+ return 0;
+}
+
+int libmpathpersist_exit(void)
+{
+ libmpathpersist_cleanup();
+ uninit_config();
return 0;
}
diff --git a/libmpathpersist/mpath_persist.h b/libmpathpersist/mpath_persist.h
index 7cf4faf9..91606efc 100644
--- a/libmpathpersist/mpath_persist.h
+++ b/libmpathpersist/mpath_persist.h
@@ -175,6 +175,22 @@ struct prout_param_descriptor { /* PROUT parameter descriptor */
* DESCRIPTION :
* Initialize device mapper multipath configuration. This function must be invoked first
* before performing reservation management functions.
+ * Either this function or mpath_lib_init() may be used.
+ * Use this function to work with libmultipath's internal "struct config".
+ * Call libmpathpersist_exit() for cleanup.
+ * RESTRICTIONS:
+ *
+ * RETURNS: 0->Success, 1->Failed.
+ */
+extern int libmpathpersist_init (void);
+
+/*
+ * DESCRIPTION :
+ * Initialize device mapper multipath configuration. This function must be invoked first
+ * before performing reservation management functions.
+ * Either this function or libmpathpersist_init() may be used.
+ * Use this function to work with an application-specific "struct config".
+ * Call mpath_lib_exit() for cleanup.
* RESTRICTIONS:
*
* RETURNS: struct config ->Success, NULL->Failed.
@@ -186,12 +202,24 @@ extern struct config * mpath_lib_init (void);
* DESCRIPTION :
* Release device mapper multipath configuration. This function must be invoked after
* performing reservation management functions.
+ * Use this after initialization with mpath_lib_init().
* RESTRICTIONS:
*
* RETURNS: 0->Success, 1->Failed.
*/
extern int mpath_lib_exit (struct config *conf);
+/*
+ * DESCRIPTION :
+ * Release device mapper multipath configuration. This function must be invoked after
+ * performing reservation management functions.
+ * Use this after initialization with libmpathpersist_init().
+ * RESTRICTIONS:
+ *
+ * RETURNS: 0->Success, 1->Failed.
+ */
+extern int libmpathpersist_exit (void);
+
/*
* DESCRIPTION :
--
2.17.2

View File

@ -0,0 +1,68 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 24 Sep 2020 15:37:10 +0200
Subject: [PATCH] multipath: use {get_put}_multipath_config from libmultipath
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/main.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/multipath/main.c b/multipath/main.c
index ce48a932..879d7ac9 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -67,7 +67,6 @@
int logsink;
struct udev *udev;
-struct config *multipath_conf;
/*
* Return values of configure(), check_path_valid(), and main().
@@ -78,16 +77,6 @@ enum {
RTVL_RETRY, /* returned by configure(), not by main() */
};
-struct config *get_multipath_config(void)
-{
- return multipath_conf;
-}
-
-void put_multipath_config(__attribute__((unused)) void *arg)
-{
- /* Noop for now */
-}
-
static int
dump_config (struct config *conf, vector hwes, vector mpvec)
{
@@ -892,10 +881,9 @@ main (int argc, char *argv[])
udev = udev_new();
logsink = 0;
- conf = load_config(DEFAULT_CONFIGFILE);
- if (!conf)
+ if (init_config(DEFAULT_CONFIGFILE))
exit(RTVL_FAIL);
- multipath_conf = conf;
+ conf = get_multipath_config();
conf->retrigger_tries = 0;
conf->force_sync = 1;
while ((arg = getopt(argc, argv, ":aAdDcChl::eFfM:v:p:b:BrR:itTquUwW")) != EOF ) {
@@ -1148,8 +1136,8 @@ out_free_config:
* the logging function (dm_write_log()), which is called there,
* references the config.
*/
- free_config(conf);
- conf = NULL;
+ put_multipath_config(conf);
+ uninit_config();
udev_unref(udev);
if (dev)
FREE(dev);
--
2.17.2

View File

@ -0,0 +1,56 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 24 Sep 2020 15:37:11 +0200
Subject: [PATCH] mpathpersist: use {get,put}_multipath_config() from
libmultipath
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
mpathpersist/main.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/mpathpersist/main.c b/mpathpersist/main.c
index 28bfe410..0f0db4b8 100644
--- a/mpathpersist/main.c
+++ b/mpathpersist/main.c
@@ -43,17 +43,6 @@ void mpath_print_transport_id(struct prin_fulldescr *fdesc);
int construct_transportid(const char * inp, struct transportid transid[], int num_transportids);
int logsink;
-struct config *multipath_conf;
-
-struct config *get_multipath_config(void)
-{
- return multipath_conf;
-}
-
-void put_multipath_config(__attribute__((unused)) void * arg)
-{
- /* Noop for now */
-}
void rcu_register_thread_memb(void) {}
@@ -620,15 +609,14 @@ int main(int argc, char *argv[])
}
udev = udev_new();
- multipath_conf = mpath_lib_init();
- if(!multipath_conf) {
+ if (libmpathpersist_init()) {
udev_unref(udev);
exit(1);
}
ret = handle_args(argc, argv, 0);
- mpath_lib_exit(multipath_conf);
+ libmpathpersist_exit();
udev_unref(udev);
return (ret >= 0) ? ret : MPATH_PR_OTHER;
--
2.17.2

View File

@ -0,0 +1,156 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 24 Sep 2020 15:37:12 +0200
Subject: [PATCH] libmultipath: add udev and logsink symbols
With these symbols added, applications using libmultipath don't
need to define global variables "udev" and "logsink" any more.
This comes at the cost of having to call an init function.
Currently, libmultipath_init() does nothing but initialize
"udev".
The linker's symbol lookup order still allows applications to use
their own "logsink" and "udev" variables, which will take precendence
over libmultipath's internal ones. In this case, calling
libmultipath_init() can be skipped, but like before,
udev should be initialized (using udev_new()) before making any
libmultipath calls.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/config.c | 46 +++++++++++++++++++++++++++++++++++++++++++
libmultipath/config.h | 46 ++++++++++++++++++++++++++++++++++++++++++-
libmultipath/debug.c | 2 ++
3 files changed, 93 insertions(+), 1 deletion(-)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index 422e923d..b3809433 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -28,6 +28,52 @@
#include "propsel.h"
#include "version.h"
+/*
+ * We don't support re-initialization after
+ * libmultipath_exit().
+ */
+static bool libmultipath_exit_called;
+static pthread_once_t _init_once = PTHREAD_ONCE_INIT;
+static pthread_once_t _exit_once = PTHREAD_ONCE_INIT;
+struct udev *udev;
+
+static void _udev_init(void)
+{
+ if (udev)
+ udev_ref(udev);
+ else
+ udev = udev_new();
+ if (!udev)
+ condlog(0, "%s: failed to initialize udev", __func__);
+}
+
+static void _libmultipath_init(void)
+{
+ _udev_init();
+}
+
+static bool _is_libmultipath_initialized(void)
+{
+ return !libmultipath_exit_called && !!udev;
+}
+
+int libmultipath_init(void)
+{
+ pthread_once(&_init_once, _libmultipath_init);
+ return !_is_libmultipath_initialized();
+}
+
+static void _libmultipath_exit(void)
+{
+ libmultipath_exit_called = true;
+ udev_unref(udev);
+}
+
+void libmultipath_exit(void)
+{
+ pthread_once(&_exit_once, _libmultipath_exit);
+}
+
static struct config __internal_config;
struct config *libmp_get_multipath_config(void)
{
diff --git a/libmultipath/config.h b/libmultipath/config.h
index 83d179ac..089b2ac2 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -235,7 +235,51 @@ struct config {
char *enable_foreign;
};
-extern struct udev * udev;
+/**
+ * extern variable: udev
+ *
+ * A &struct udev instance used by libmultipath. libmultipath expects
+ * a valid, initialized &struct udev in this variable.
+ * An application can define this variable itself, in which case
+ * the applications's instance will take precedence.
+ * The application can initialize and destroy this variable by
+ * calling libmultipath_init() and libmultipath_exit(), respectively,
+ * whether or not it defines the variable itself.
+ * An application can initialize udev with udev_new() before calling
+ * libmultipath_init(), e.g. if it has to make libudev calls before
+ * libmultipath calls. If an application wants to keep using the
+ * udev variable after calling libmultipath_exit(), it should have taken
+ * an additional reference on it beforehand. This is the case e.g.
+ * after initiazing udev with udev_new().
+ */
+extern struct udev *udev;
+
+/**
+ * libmultipath_init() - library initialization
+ *
+ * This function initializes libmultipath data structures.
+ * It is light-weight; some other initializations, like device-mapper
+ * initialization, are done lazily when the respective functionality
+ * is required.
+ *
+ * Clean up by libmultipath_exit() when the program terminates.
+ * It is an error to call libmultipath_init() after libmultipath_exit().
+ * Return: 0 on success, 1 on failure.
+ */
+int libmultipath_init(void);
+
+/**
+ * libmultipath_exit() - library un-initialization
+ *
+ * This function un-initializes libmultipath data structures.
+ * It is recommended to call this function at program exit.
+ *
+ * Calls to libmultipath_init() after libmultipath_exit() will fail
+ * (in other words, libmultipath can't be re-initialized).
+ * Any other libmultipath calls after libmultipath_exit() may cause
+ * undefined behavior.
+ */
+void libmultipath_exit(void);
int find_hwe (const struct _vector *hwtable,
const char * vendor, const char * product, const char *revision,
diff --git a/libmultipath/debug.c b/libmultipath/debug.c
index 4128cb90..b3a1de9e 100644
--- a/libmultipath/debug.c
+++ b/libmultipath/debug.c
@@ -15,6 +15,8 @@
#include "defaults.h"
#include "debug.h"
+int logsink;
+
void dlog (int sink, int prio, const char * fmt, ...)
{
va_list ap;
--
2.17.2

View File

@ -0,0 +1,49 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 24 Sep 2020 15:37:13 +0200
Subject: [PATCH] multipath: remove logsink and udev
We can use libmultipath's symbols now.
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/main.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/multipath/main.c b/multipath/main.c
index 879d7ac9..322b30e0 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -65,9 +65,6 @@
#include "file.h"
#include "valid.h"
-int logsink;
-struct udev *udev;
-
/*
* Return values of configure(), check_path_valid(), and main().
*/
@@ -879,7 +876,7 @@ main (int argc, char *argv[])
int retries = -1;
bool enable_foreign = false;
- udev = udev_new();
+ libmultipath_init();
logsink = 0;
if (init_config(DEFAULT_CONFIGFILE))
exit(RTVL_FAIL);
@@ -1138,7 +1135,7 @@ out_free_config:
*/
put_multipath_config(conf);
uninit_config();
- udev_unref(udev);
+ libmultipath_exit();
if (dev)
FREE(dev);
#ifdef _DEBUG_
--
2.17.2

View File

@ -0,0 +1,98 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 24 Sep 2020 15:37:14 +0200
Subject: [PATCH] libmpathpersist: call libmultipath_{init,exit}()
Have libmpathpersist_{init,exit} do the udev initialization, too.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathpersist/mpath_persist.c | 13 +++++++++----
libmpathpersist/mpath_persist.h | 9 ++++++---
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 9dfc98cd..d1538195 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -48,6 +48,10 @@ int libmpathpersist_init(void)
struct config *conf;
int rc = 0;
+ if (libmultipath_init()) {
+ condlog(0, "Failed to initialize libmultipath.");
+ return 1;
+ }
if (init_config(DEFAULT_CONFIGFILE)) {
condlog(0, "Failed to initialize multipath config.");
return 1;
@@ -74,24 +78,25 @@ mpath_lib_init (void)
static void libmpathpersist_cleanup(void)
{
- dm_lib_release();
- dm_lib_exit();
cleanup_prio();
cleanup_checkers();
+ libmultipath_exit();
+ dm_lib_release();
+ dm_lib_exit();
}
int
mpath_lib_exit (struct config *conf)
{
- libmpathpersist_cleanup();
free_config(conf);
+ libmpathpersist_cleanup();
return 0;
}
int libmpathpersist_exit(void)
{
- libmpathpersist_cleanup();
uninit_config();
+ libmpathpersist_cleanup();
return 0;
}
diff --git a/libmpathpersist/mpath_persist.h b/libmpathpersist/mpath_persist.h
index 91606efc..5435eae4 100644
--- a/libmpathpersist/mpath_persist.h
+++ b/libmpathpersist/mpath_persist.h
@@ -176,7 +176,8 @@ struct prout_param_descriptor { /* PROUT parameter descriptor */
* Initialize device mapper multipath configuration. This function must be invoked first
* before performing reservation management functions.
* Either this function or mpath_lib_init() may be used.
- * Use this function to work with libmultipath's internal "struct config".
+ * Use this function to work with libmultipath's internal "struct config"
+ * and "struct udev". The latter will be initialized automatically.
* Call libmpathpersist_exit() for cleanup.
* RESTRICTIONS:
*
@@ -189,7 +190,8 @@ extern int libmpathpersist_init (void);
* Initialize device mapper multipath configuration. This function must be invoked first
* before performing reservation management functions.
* Either this function or libmpathpersist_init() may be used.
- * Use this function to work with an application-specific "struct config".
+ * Use this function to work with an application-specific "struct config"
+ * and "struct udev". The latter must be initialized by the application.
* Call mpath_lib_exit() for cleanup.
* RESTRICTIONS:
*
@@ -211,9 +213,10 @@ extern int mpath_lib_exit (struct config *conf);
/*
* DESCRIPTION :
- * Release device mapper multipath configuration. This function must be invoked after
+ * Release device mapper multipath configuration a. This function must be invoked after
* performing reservation management functions.
* Use this after initialization with libmpathpersist_init().
+ * Calling libmpathpersist_init() after libmpathpersist_exit() will fail.
* RESTRICTIONS:
*
* RETURNS: 0->Success, 1->Failed.
--
2.17.2

View File

@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 24 Sep 2020 15:37:15 +0200
Subject: [PATCH] mpathpersist: remove logsink and udev
We can use libmultipath's internal symbols now. The libmultipath
initialization is taken care of by libmpathpersist_init().
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
mpathpersist/main.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/mpathpersist/main.c b/mpathpersist/main.c
index 0f0db4b8..a25b08f0 100644
--- a/mpathpersist/main.c
+++ b/mpathpersist/main.c
@@ -42,13 +42,10 @@ void * mpath_alloc_prin_response(int prin_sa);
void mpath_print_transport_id(struct prin_fulldescr *fdesc);
int construct_transportid(const char * inp, struct transportid transid[], int num_transportids);
-int logsink;
-
void rcu_register_thread_memb(void) {}
void rcu_unregister_thread_memb(void) {}
-struct udev *udev;
static int verbose, loglevel, noisy;
@@ -608,16 +605,13 @@ int main(int argc, char *argv[])
exit (1);
}
- udev = udev_new();
if (libmpathpersist_init()) {
- udev_unref(udev);
exit(1);
}
ret = handle_args(argc, argv, 0);
libmpathpersist_exit();
- udev_unref(udev);
return (ret >= 0) ? ret : MPATH_PR_OTHER;
}
--
2.17.2

View File

@ -0,0 +1,57 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 24 Sep 2020 15:37:16 +0200
Subject: [PATCH] multipathd: remove logsink and udev
We can use the symbols from libmultipath now.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 48b62937..6a4b8b83 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -113,7 +113,6 @@ struct mpath_event_param
struct multipath *mpp;
};
-int logsink;
int uxsock_timeout;
int verbosity;
int bindings_read_only;
@@ -144,8 +143,6 @@ static inline enum daemon_status get_running_state(void)
*/
struct vectors * gvecs;
-struct udev * udev;
-
struct config *multipath_conf;
/* Local variables */
@@ -3009,8 +3006,6 @@ child (__attribute__((unused)) void *param)
conf = rcu_dereference(multipath_conf);
rcu_assign_pointer(multipath_conf, NULL);
call_rcu(&conf->rcu, rcu_free_config);
- udev_unref(udev);
- udev = NULL;
pthread_attr_destroy(&waiter_attr);
pthread_attr_destroy(&io_err_stat_attr);
#ifdef _DEBUG_
@@ -3114,7 +3109,9 @@ main (int argc, char *argv[])
pthread_cond_init_mono(&config_cond);
- udev = udev_new();
+ libmultipath_init();
+ if (atexit(libmultipath_exit))
+ condlog(3, "failed to register exit handler for libmultipath");
libmp_udev_set_sync_support(0);
while ((arg = getopt(argc, argv, ":dsv:k::Bniw")) != EOF ) {
--
2.17.2

View File

@ -0,0 +1,180 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Sat, 26 Sep 2020 23:25:46 -0500
Subject: [PATCH] libmpathvalid: use default *_multipath_config, udev, and
logsink
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathvalid/libmpathvalid.version | 2 +-
libmpathvalid/mpath_valid.c | 73 ++++++++++++++++++++---------
libmpathvalid/mpath_valid.h | 12 +++--
3 files changed, 61 insertions(+), 26 deletions(-)
diff --git a/libmpathvalid/libmpathvalid.version b/libmpathvalid/libmpathvalid.version
index 4d8a8ba4..3bd0d3c5 100644
--- a/libmpathvalid/libmpathvalid.version
+++ b/libmpathvalid/libmpathvalid.version
@@ -1,7 +1,7 @@
MPATH_1.0 {
global:
- mpathvalid_conf;
mpathvalid_init;
+ mpathvalid_reload_config;
mpathvalid_exit;
mpathvalid_is_path;
mpathvalid_get_mode;
diff --git a/libmpathvalid/mpath_valid.c b/libmpathvalid/mpath_valid.c
index 6153e8b7..d839dbac 100644
--- a/libmpathvalid/mpath_valid.c
+++ b/libmpathvalid/mpath_valid.c
@@ -15,9 +15,7 @@
#include "mpath_cmd.h"
#include "valid.h"
#include "mpath_valid.h"
-
-static struct config default_config = { .verbosity = -1 };
-struct config *mpathvalid_conf = &default_config;
+#include "debug.h"
static unsigned int get_conf_mode(struct config *conf)
{
@@ -68,38 +66,70 @@ static int convert_result(int result) {
}
int
-mpathvalid_init(int verbosity)
+mpathvalid_init(int verbosity, int log_style)
{
unsigned int version[3];
struct config *conf;
- default_config.verbosity = verbosity;
- skip_libmp_dm_init();
- conf = load_config(DEFAULT_CONFIGFILE);
- if (!conf)
+ logsink = log_style;
+ if (libmultipath_init())
return -1;
+ conf = get_multipath_config();
conf->verbosity = verbosity;
- if (dm_prereq(version))
+ put_multipath_config(conf);
+
+ skip_libmp_dm_init();
+ if (init_config(DEFAULT_CONFIGFILE))
goto fail;
- memcpy(conf->version, version, sizeof(version));
+ if (dm_prereq(version))
+ goto fail_config;
- mpathvalid_conf = conf;
+ conf = get_multipath_config();
+ conf->verbosity = verbosity;
+ memcpy(conf->version, version, sizeof(version));
+ put_multipath_config(conf);
return 0;
+
+fail_config:
+ uninit_config();
fail:
- free_config(conf);
+ libmultipath_exit();
return -1;
}
int
-mpathvalid_exit(void)
+mpathvalid_reload_config(void)
{
- struct config *conf = mpathvalid_conf;
+ int verbosity;
+ unsigned int version[3];
+ struct config *conf;
+
+ conf = get_multipath_config();
+ memcpy(version, conf->version, sizeof(version));
+ verbosity = conf->verbosity;
+ put_multipath_config(conf);
- default_config.verbosity = -1;
- if (mpathvalid_conf == &default_config)
- return 0;
- mpathvalid_conf = &default_config;
- free_config(conf);
+ uninit_config();
+
+ conf = get_multipath_config();
+ conf->verbosity = verbosity;
+ put_multipath_config(conf);
+
+ if (init_config(DEFAULT_CONFIGFILE))
+ return -1;
+
+ conf = get_multipath_config();
+ conf->verbosity = verbosity;
+ memcpy(conf->version, version, sizeof(version));
+ put_multipath_config(conf);
+ return 0;
+}
+
+int
+mpathvalid_exit(void)
+{
+ uninit_config();
+ libmultipath_exit();
return 0;
}
@@ -121,9 +151,10 @@ mpathvalid_is_path(const char *name, unsigned int mode, char **wwid,
if (!name || mode >= MPATH_MAX_MODE)
return r;
-
if (nr_paths > 0 && !path_wwids)
return r;
+ if (!udev)
+ return r;
pp = alloc_path();
if (!pp)
@@ -136,7 +167,7 @@ mpathvalid_is_path(const char *name, unsigned int mode, char **wwid,
}
conf = get_multipath_config();
- if (!conf || conf == &default_config)
+ if (!conf)
goto out_wwid;
if (mode != MPATH_DEFAULT)
set_conf_mode(conf, mode);
diff --git a/libmpathvalid/mpath_valid.h b/libmpathvalid/mpath_valid.h
index 7fd8aa47..c83b8da5 100644
--- a/libmpathvalid/mpath_valid.h
+++ b/libmpathvalid/mpath_valid.h
@@ -42,15 +42,19 @@ enum mpath_valid_result {
MPATH_IS_MAYBE_VALID,
};
-struct config;
-extern struct config *mpathvalid_conf;
-int mpathvalid_init(int verbosity);
+enum mpath_valid_log_style {
+ MPATH_LOG_STDIO = -1,
+ MPATH_LOG_STDIO_TIMESTAMP,
+ MPATH_LOG_SYSLOG,
+};
+
+int mpathvalid_init(int verbosity, int log_style);
+int mpathvalid_reload_config(void);
int mpathvalid_exit(void);
unsigned int mpathvalid_get_mode(void);
int mpathvalid_is_path(const char *name, unsigned int mode, char **wwid,
const char **path_wwids, unsigned int nr_paths);
-
#ifdef __cplusplus
}
#endif
--
2.17.2

View File

@ -0,0 +1,186 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Sat, 26 Sep 2020 23:26:32 -0500
Subject: [PATCH] Revert "libmultipath: add ignore_udev_uid option"
This reverts commit f1350bc5c4aa445804f3f4fc8968fb46d581336e.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/config.h | 1 -
libmultipath/dict.c | 4 ----
libmultipath/discovery.c | 17 ++++++-----------
libmultipath/discovery.h | 8 +-------
libmultipath/uevent.c | 2 +-
multipath/multipath.conf.5 | 13 -------------
multipathd/main.c | 7 +------
7 files changed, 9 insertions(+), 43 deletions(-)
diff --git a/libmultipath/config.h b/libmultipath/config.h
index 089b2ac2..576f15d1 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -192,7 +192,6 @@ struct config {
int find_multipaths_timeout;
int marginal_pathgroups;
int skip_delegate;
- int ignore_udev_uid;
unsigned int version[3];
unsigned int sequence_nr;
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 9a0729bf..184d4b22 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -1406,9 +1406,6 @@ declare_hw_snprint(all_tg_pt, print_yes_no_undef)
declare_def_handler(marginal_pathgroups, set_yes_no)
declare_def_snprint(marginal_pathgroups, print_yes_no)
-declare_def_handler(ignore_udev_uid, set_yes_no)
-declare_def_snprint(ignore_udev_uid, print_yes_no)
-
static int
def_uxsock_timeout_handler(struct config *conf, vector strvec)
{
@@ -1819,7 +1816,6 @@ init_keywords(vector keywords)
install_keyword("enable_foreign", &def_enable_foreign_handler,
&snprint_def_enable_foreign);
install_keyword("marginal_pathgroups", &def_marginal_pathgroups_handler, &snprint_def_marginal_pathgroups);
- install_keyword("ignore_udev_uid", &def_ignore_udev_uid_handler, &snprint_def_ignore_udev_uid);
__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
__deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL);
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index f0e92227..002d3d18 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -2010,7 +2010,7 @@ static bool has_uid_fallback(struct path *pp)
int
get_uid (struct path * pp, int path_state, struct udev_device *udev,
- int fallback)
+ int allow_fallback)
{
char *c;
const char *origin = "unknown";
@@ -2043,9 +2043,7 @@ get_uid (struct path * pp, int path_state, struct udev_device *udev,
} else
len = strlen(pp->wwid);
origin = "callout";
- } else if (fallback == UID_FALLBACK_FORCE)
- len = uid_fallback(pp, path_state, &origin);
- else {
+ } else {
bool udev_available = udev && pp->uid_attribute
&& *pp->uid_attribute;
@@ -2058,9 +2056,8 @@ get_uid (struct path * pp, int path_state, struct udev_device *udev,
else
origin = "udev";
}
- if ((!udev_available ||
- (len <= 0 && fallback == UID_FALLBACK_ALLOW)) &&
- has_uid_fallback(pp)) {
+ if ((!udev_available || (len <= 0 && allow_fallback))
+ && has_uid_fallback(pp)) {
used_fallback = 1;
len = uid_fallback(pp, path_state, &origin);
}
@@ -2200,10 +2197,8 @@ int pathinfo(struct path *pp, struct config *conf, int mask)
}
if ((mask & DI_WWID) && !strlen(pp->wwid)) {
- int fallback = conf->ignore_udev_uid? UID_FALLBACK_FORCE :
- (pp->retriggers >= conf->retrigger_tries)?
- UID_FALLBACK_ALLOW : UID_FALLBACK_NONE;
- get_uid(pp, path_state, pp->udev, fallback);
+ get_uid(pp, path_state, pp->udev,
+ (pp->retriggers >= conf->retrigger_tries));
if (!strlen(pp->wwid)) {
if (pp->bus == SYSFS_BUS_UNDEF)
return PATHINFO_SKIPPED;
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index ca8542d6..6444887d 100644
--- a/libmultipath/discovery.h
+++ b/libmultipath/discovery.h
@@ -54,14 +54,8 @@ ssize_t sysfs_get_inquiry(struct udev_device *udev,
unsigned char *buff, size_t len);
int sysfs_get_asymmetric_access_state(struct path *pp,
char *buff, int buflen);
-
-enum {
- UID_FALLBACK_NONE,
- UID_FALLBACK_ALLOW,
- UID_FALLBACK_FORCE,
-};
int get_uid(struct path * pp, int path_state, struct udev_device *udev,
- int fallback);
+ int allow_fallback);
/*
* discovery bitmask
diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index d67129d1..e0d13b11 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -179,7 +179,7 @@ uevent_need_merge(void)
bool need_merge = false;
conf = get_multipath_config();
- if (!conf->ignore_udev_uid && VECTOR_SIZE(&conf->uid_attrs) > 0)
+ if (VECTOR_SIZE(&conf->uid_attrs) > 0)
need_merge = true;
put_multipath_config(conf);
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 175ca095..42a192f6 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -286,19 +286,6 @@ The default is: \fB<unset>\fR
.
.
.TP
-.B ignore_udev_uid
-Setting this option to yes will force multipath to ignore the the uid_attrs
-and uid_attribute settings, and generate the WWID by the \fIsysfs\fR
-method. This will cause devices that cannot get their WWID from the standard
-locations for their device type to not get a WWID; see \fBWWID generation\fR
-below.
-.RS
-.TP
-The default is: \fBno\fR
-.RE
-.
-.
-.TP
.B prio
The name of the path priority routine. The specified routine
should return a numeric value specifying the relative priority
diff --git a/multipathd/main.c b/multipathd/main.c
index 6a4b8b83..94926b57 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1223,7 +1223,6 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
if (pp) {
struct multipath *mpp = pp->mpp;
char wwid[WWID_SIZE];
- int fallback;
if (pp->initialized == INIT_REQUESTED_UDEV) {
needs_reinit = 1;
@@ -1235,11 +1234,7 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
goto out;
strcpy(wwid, pp->wwid);
- conf = get_multipath_config();
- fallback = conf->ignore_udev_uid? UID_FALLBACK_FORCE:
- UID_FALLBACK_NONE;
- put_multipath_config(conf);
- rc = get_uid(pp, pp->state, uev->udev, fallback);
+ rc = get_uid(pp, pp->state, uev->udev, 0);
if (rc != 0)
strcpy(pp->wwid, wwid);
--
2.17.2

View File

@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 22 Sep 2020 16:03:31 -0500
Subject: [PATCH] libmultipath: change log level for null uid_attribute
If uid_attribute is explicitly set to an empty string, multipath should
log the uid at the default log level, since using the fallback code is
the expected behavior.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/discovery.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 002d3d18..77468524 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -2058,7 +2058,8 @@ get_uid (struct path * pp, int path_state, struct udev_device *udev,
}
if ((!udev_available || (len <= 0 && allow_fallback))
&& has_uid_fallback(pp)) {
- used_fallback = 1;
+ if (udev_available || !(udev && pp->uid_attribute))
+ used_fallback = 1;
len = uid_fallback(pp, path_state, &origin);
}
}
--
2.17.2

View File

@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 11 Aug 2020 21:08:27 +0200
Subject: [PATCH] libmultipath: orphan_paths(): avoid BUG message
Since c44d769, we print a BUG message when we orphan a path that
holds the mpp->hwe pointer. But if this called via orphan_paths(),
this is expected and we shouldn't warn.
Fixes: c44d769 ("libmultipath: warn if freeing path that holds mpp->hwe")
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/structs_vec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index ede14297..d70bb6ad 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -114,6 +114,8 @@ void orphan_paths(vector pathvec, struct multipath *mpp, const char *reason)
int i;
struct path * pp;
+ /* Avoid BUG message from orphan_path() */
+ mpp->hwe = NULL;
vector_foreach_slot (pathvec, pp, i) {
if (pp->mpp == mpp) {
orphan_path(pp, reason);
--
2.17.2

View File

@ -1,6 +1,6 @@
Name: device-mapper-multipath
Version: 0.8.4
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Tools to manage multipath devices using device-mapper
License: GPLv2
URL: http://christophe.varoqui.free.fr/
@ -82,6 +82,21 @@ Patch0069: 0069-RH-work-around-gcc-10-format-truncation-issue.patch
Patch0070: 0070-multipath-add-libmpathvalid-library.patch
Patch0071: 0071-libmultipath-add-uid-failback-for-dasd-devices.patch
Patch0072: 0072-libmultipath-add-ignore_udev_uid-option.patch
Patch0073: 0073-libmultipath-util-constify-function-arguments.patch
Patch0074: 0074-libmultipath-constify-file-argument-in-config-parser.patch
Patch0075: 0075-libmultipath-provide-defaults-for-get-put-_multipath.patch
Patch0076: 0076-libmpathpersist-allow-using-libmultipath-get-put-_mu.patch
Patch0077: 0077-multipath-use-get_put-_multipath_config-from-libmult.patch
Patch0078: 0078-mpathpersist-use-get-put-_multipath_config-from-libm.patch
Patch0079: 0079-libmultipath-add-udev-and-logsink-symbols.patch
Patch0080: 0080-multipath-remove-logsink-and-udev.patch
Patch0081: 0081-libmpathpersist-call-libmultipath_-init-exit.patch
Patch0082: 0082-mpathpersist-remove-logsink-and-udev.patch
Patch0083: 0083-multipathd-remove-logsink-and-udev.patch
Patch0084: 0084-libmpathvalid-use-default-_multipath_config-udev-and.patch
Patch0085: 0085-Revert-libmultipath-add-ignore_udev_uid-option.patch
Patch0086: 0086-libmultipath-change-log-level-for-null-uid_attribute.patch
Patch0087: 0087-libmultipath-orphan_paths-avoid-BUG-message.patch
# runtime
Requires: %{name}-libs = %{version}-%{release}
@ -278,6 +293,26 @@ fi
%{_pkgconfdir}/libdmmp.pc
%changelog
* Sun Sep 27 2020 Benjamin Marzinski <bmarzins@redhat.com> - 0.8.4-7
- Add 0073-libmultipath-util-constify-function-arguments.patch
- Add 0074-libmultipath-constify-file-argument-in-config-parser.patch
- Add 0075-libmultipath-provide-defaults-for-get-put-_multipath.patch
- Add 0076-libmpathpersist-allow-using-libmultipath-get-put-_mu.patch
- Add 0077-multipath-use-get_put-_multipath_config-from-libmult.patch
- Add 0078-mpathpersist-use-get-put-_multipath_config-from-libm.patch
- Add 0079-libmultipath-add-udev-and-logsink-symbols.patch
- Add 0080-multipath-remove-logsink-and-udev.patch
- Add 0081-libmpathpersist-call-libmultipath_-init-exit.patch
- Add 0082-mpathpersist-remove-logsink-and-udev.patch
- Add 0083-multipathd-remove-logsink-and-udev.patch
* Pull in upsteam library changes
- Add 0084-libmpathvalid-use-default-_multipath_config-udev-and.patch
- Add 0085-Revert-libmultipath-add-ignore_udev_uid-option.patch
- Add 0086-libmultipath-change-log-level-for-null-uid_attribute.patch
- Add 0087-libmultipath-orphan_paths-avoid-BUG-message.patch
* update libmpathvalid to use upstream library changes. changes
submitted upstream
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild