@@ -925,12 +925,14 @@ coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, int force_r
* 2 - blacklist
*/
extern int
-get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid)
+get_refwwid (enum mpath_cmds cmd, char * dev, enum devtypes dev_type,
+ vector pathvec, char **wwid)
{
int ret = 1;
struct path * pp;
char buff[FILE_NAME_SIZE];
char * refwwid = NULL, tmpwwid[WWID_SIZE];
+ int flags = DI_SYSFS | DI_WWID;
if (!wwid)
return 1;
@@ -939,6 +941,9 @@ get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid)
if (dev_type == DEV_NONE)
return 1;
+ if (cmd != CMD_REMOVE_WWID)
+ flags |= DI_BLACKLIST;
+
if (dev_type == DEV_DEVNODE) {
if (basenamecpy(dev, buff, FILE_NAME_SIZE) == 0) {
condlog(1, "basename failed for '%s' (%s)",
@@ -955,7 +960,7 @@ get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid)
return 1;
}
ret = store_pathinfo(pathvec, conf->hwtable, udevice,
- DI_SYSFS | DI_WWID, &pp);
+ flags, &pp);
udev_device_unref(udevice);
if (!pp) {
if (ret == 1)
@@ -987,7 +992,7 @@ get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid)
return 1;
}
ret = store_pathinfo(pathvec, conf->hwtable, udevice,
- DI_SYSFS | DI_WWID, &pp);
+ flags, &pp);
udev_device_unref(udevice);
if (!pp) {
if (ret == 1)
@@ -1012,7 +1017,7 @@ get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid)
return 1;
}
ret = store_pathinfo(pathvec, conf->hwtable, udevice,
- DI_SYSFS | DI_WWID, &pp);
+ flags, &pp);
udev_device_unref(udevice);
if (!pp) {
if (ret == 1)
@@ -29,6 +29,7 @@ int setup_map (struct multipath * mpp, char * params, int params_size );
int domap (struct multipath * mpp, char * params, int is_daemon);
int reinstate_paths (struct multipath *mpp);
int coalesce_paths (struct vectors *vecs, vector curmp, char * refwwid, int force_reload, enum mpath_cmds cmd);
-int get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid);
+int get_refwwid (enum mpath_cmds cmd, char * dev, enum devtypes dev_type,
+ vector pathvec, char **wwid);
int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh, int is_daemon);
int sysfs_get_host_adapter_name(struct path *pp, char *adapter_name);
@@ -90,9 +90,7 @@ store_pathinfo (vector pathvec, vector hwtable, struct udev_device *udevice,
goto out;
}
pp->udev = udev_device_ref(udevice);
- err = pathinfo(pp, hwtable,
- (conf->cmd == CMD_REMOVE_WWID)? flag :
- (flag | DI_BLACKLIST));
+ err = pathinfo(pp, hwtable, flag);
if (err)
goto out;
@@ -281,8 +281,8 @@ configure (void)
* failing the translation is fatal (by policy)
*/
if (conf->dev) {
- int failed = get_refwwid(conf->dev, conf->dev_type, pathvec,
- &refwwid);
+ int failed = get_refwwid(conf->cmd, conf->dev, conf->dev_type,
+ pathvec, &refwwid);
if (!refwwid) {
condlog(4, "%s: failed to get wwid", conf->dev);
if (failed == 2 && conf->cmd == CMD_VALID_PATH)
@@ -708,8 +708,8 @@ cli_add_map (void * v, char ** reply, int * len, void * data)
if (!alias && !count) {
condlog(2, "%s: mapname not found for %d:%d",
param, major, minor);
- rc = get_refwwid(param, DEV_DEVMAP, vecs->pathvec,
- &refwwid);
+ rc = get_refwwid(CMD_NONE, param, DEV_DEVMAP,
+ vecs->pathvec, &refwwid);
if (refwwid) {
if (coalesce_paths(vecs, NULL, refwwid, 0, 1))
condlog(2, "%s: coalesce_paths failed",
@@ -484,7 +484,7 @@ ev_add_map (char * dev, char * alias, struct vectors * vecs)
return 1;
}
}
- r = get_refwwid(dev, DEV_DEVMAP, vecs->pathvec, &refwwid);
+ r = get_refwwid(CMD_NONE, dev, DEV_DEVMAP, vecs->pathvec, &refwwid);
if (refwwid) {
r = coalesce_paths(vecs, NULL, refwwid, 0, CMD_NONE);
This patch adds an 'cmd' argument to get_refwwid(). This allows store_pathvec() to be simplified and avoids accesses to conf->cmd. Signed-off-by: Hannes Reinecke <hare@suse.com> --- libmultipath/configure.c | 13 +++++++++---- libmultipath/configure.h | 3 ++- libmultipath/discovery.c | 4 +--- multipath/main.c | 4 ++-- multipathd/cli_handlers.c | 4 ++-- multipathd/main.c | 2 +- 6 files changed, 17 insertions(+), 13 deletions(-)