[dm-devel] [PATCH 10/33] multipath: avoid crash when using modified configuration
Martin Wilck
mwilck at suse.com
Tue Feb 28 16:23:06 UTC 2017
From: Hannes Reinecke <hare at suse.de>
Occasionally multipath would crash when using a modified configuration.
Signed-off-by: Hannes Reinecke <hare at suse.com>
---
libmultipath/discovery.c | 2 +-
multipath/main.c | 10 ++++------
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index e4186de1..bd8ab557 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1801,7 +1801,7 @@ int pathinfo(struct path *pp, struct config *conf, int mask)
{
int path_state;
- if (!pp)
+ if (!pp || !conf)
return PATHINFO_FAILED;
/*
diff --git a/multipath/main.c b/multipath/main.c
index befe4c53..5811630c 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -266,7 +266,8 @@ get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid)
* 1: Failure
*/
static int
-configure (enum mpath_cmds cmd, enum devtypes dev_type, char *devpath)
+configure (struct config *conf, enum mpath_cmds cmd,
+ enum devtypes dev_type, char *devpath)
{
vector curmp = NULL;
vector pathvec = NULL;
@@ -275,7 +276,6 @@ configure (enum mpath_cmds cmd, enum devtypes dev_type, char *devpath)
int di_flag = 0;
char * refwwid = NULL;
char * dev = NULL;
- struct config *conf;
/*
* allocate core vectors to store paths and multipaths
@@ -295,7 +295,6 @@ configure (enum mpath_cmds cmd, enum devtypes dev_type, char *devpath)
/*
* if we have a blacklisted device parameter, exit early
*/
- conf = get_multipath_config();
if (dev && (dev_type == DEV_DEVNODE ||
dev_type == DEV_UEVENT) &&
cmd != CMD_REMOVE_WWID &&
@@ -304,10 +303,9 @@ configure (enum mpath_cmds cmd, enum devtypes dev_type, char *devpath)
if (cmd == CMD_VALID_PATH)
printf("%s is not a valid multipath device path\n",
devpath);
- put_multipath_config(conf);
goto out;
}
- put_multipath_config(conf);
+
/*
* scope limiting must be translated into a wwid
* failing the translation is fatal (by policy)
@@ -730,7 +728,7 @@ main (int argc, char *argv[])
r = dm_flush_maps(retries);
goto out;
}
- while ((r = configure(cmd, dev_type, dev)) < 0)
+ while ((r = configure(conf, cmd, dev_type, dev)) < 0)
condlog(3, "restart multipath configuration process");
out:
--
2.11.0
More information about the dm-devel
mailing list