|
|
027535 |
---
|
|
|
027535 |
libmpathpersist/mpath_persist.c | 14 ++++++------
|
|
|
027535 |
libmultipath/discovery.c | 46 ++++++++++++++++++++--------------------
|
|
|
027535 |
libmultipath/discovery.h | 4 +++
|
|
|
027535 |
multipath/main.c | 2 -
|
|
|
027535 |
multipathd/main.c | 6 +++--
|
|
|
027535 |
5 files changed, 39 insertions(+), 33 deletions(-)
|
|
|
027535 |
|
|
|
c896fb |
Index: multipath-tools-130222/libmpathpersist/mpath_persist.c
|
|
|
027535 |
===================================================================
|
|
|
c896fb |
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c
|
|
|
c896fb |
+++ multipath-tools-130222/libmpathpersist/mpath_persist.c
|
|
|
027535 |
@@ -178,7 +178,7 @@ int mpath_persistent_reserve_in (int fd,
|
|
|
027535 |
goto out;
|
|
|
027535 |
}
|
|
|
027535 |
|
|
|
027535 |
- if (path_discovery(pathvec, conf, DI_SYSFS | DI_CHECKER)) {
|
|
|
027535 |
+ if (path_discovery(pathvec, conf, DI_SYSFS | DI_CHECKER) < 0) {
|
|
|
027535 |
ret = MPATH_PR_DMMP_ERROR;
|
|
|
027535 |
goto out1;
|
|
|
027535 |
}
|
|
|
027535 |
@@ -262,13 +262,13 @@ int mpath_persistent_reserve_out ( int f
|
|
|
027535 |
curmp = vector_alloc ();
|
|
|
027535 |
pathvec = vector_alloc ();
|
|
|
027535 |
|
|
|
027535 |
- if (!curmp || !pathvec){
|
|
|
027535 |
- condlog (0, "%s: vector allocation failed.", alias);
|
|
|
027535 |
- ret = MPATH_PR_DMMP_ERROR;
|
|
|
027535 |
- goto out;
|
|
|
027535 |
- }
|
|
|
027535 |
+ if (!curmp || !pathvec){
|
|
|
027535 |
+ condlog (0, "%s: vector allocation failed.", alias);
|
|
|
027535 |
+ ret = MPATH_PR_DMMP_ERROR;
|
|
|
027535 |
+ goto out;
|
|
|
027535 |
+ }
|
|
|
027535 |
|
|
|
027535 |
- if (path_discovery(pathvec, conf, DI_SYSFS | DI_CHECKER)) {
|
|
|
027535 |
+ if (path_discovery(pathvec, conf, DI_SYSFS | DI_CHECKER) < 0) {
|
|
|
027535 |
ret = MPATH_PR_DMMP_ERROR;
|
|
|
027535 |
goto out1;
|
|
|
027535 |
}
|
|
|
c896fb |
Index: multipath-tools-130222/libmultipath/discovery.c
|
|
|
027535 |
===================================================================
|
|
|
c896fb |
--- multipath-tools-130222.orig/libmultipath/discovery.c
|
|
|
c896fb |
+++ multipath-tools-130222/libmultipath/discovery.c
|
|
|
027535 |
@@ -32,7 +32,7 @@ int
|
|
|
027535 |
store_pathinfo (vector pathvec, vector hwtable, struct udev_device *udevice,
|
|
|
027535 |
int flag, struct path **pp_ptr)
|
|
|
027535 |
{
|
|
|
027535 |
- int err = 1;
|
|
|
027535 |
+ int err = PATHINFO_FAILED;
|
|
|
027535 |
struct path * pp;
|
|
|
027535 |
const char * devname;
|
|
|
027535 |
|
|
|
027535 |
@@ -41,12 +41,12 @@ store_pathinfo (vector pathvec, vector h
|
|
|
027535 |
|
|
|
027535 |
devname = udev_device_get_sysname(udevice);
|
|
|
027535 |
if (!devname)
|
|
|
027535 |
- return 1;
|
|
|
027535 |
+ return PATHINFO_FAILED;
|
|
|
027535 |
|
|
|
027535 |
pp = alloc_path();
|
|
|
027535 |
|
|
|
027535 |
if (!pp)
|
|
|
027535 |
- return 1;
|
|
|
027535 |
+ return PATHINFO_FAILED;
|
|
|
027535 |
|
|
|
027535 |
if(safe_sprintf(pp->dev, "%s", devname)) {
|
|
|
027535 |
condlog(0, "pp->dev too small");
|
|
|
027535 |
@@ -80,19 +80,16 @@ path_discover (vector pathvec, struct co
|
|
|
027535 |
|
|
|
027535 |
devname = udev_device_get_sysname(udevice);
|
|
|
027535 |
if (!devname)
|
|
|
027535 |
- return 0;
|
|
|
027535 |
+ return PATHINFO_FAILED;
|
|
|
027535 |
|
|
|
027535 |
if (filter_devnode(conf->blist_devnode, conf->elist_devnode,
|
|
|
027535 |
(char *)devname) > 0)
|
|
|
027535 |
- return 0;
|
|
|
027535 |
+ return PATHINFO_SKIPPED;
|
|
|
027535 |
|
|
|
027535 |
pp = find_path_by_dev(pathvec, (char *)devname);
|
|
|
027535 |
if (!pp) {
|
|
|
027535 |
- if (store_pathinfo(pathvec, conf->hwtable,
|
|
|
027535 |
- udevice, flag, NULL) != 1)
|
|
|
027535 |
- return 0;
|
|
|
027535 |
- else
|
|
|
027535 |
- return 1;
|
|
|
027535 |
+ return store_pathinfo(pathvec, conf->hwtable,
|
|
|
027535 |
+ udevice, flag, NULL);
|
|
|
027535 |
}
|
|
|
027535 |
return pathinfo(pp, conf->hwtable, flag);
|
|
|
027535 |
}
|
|
|
027535 |
@@ -104,11 +101,11 @@ path_discovery (vector pathvec, struct c
|
|
|
027535 |
struct udev_list_entry *entry;
|
|
|
027535 |
struct udev_device *udevice;
|
|
|
027535 |
const char *devpath;
|
|
|
027535 |
- int r = 0;
|
|
|
027535 |
+ int num_paths = 0, total_paths = 0;
|
|
|
027535 |
|
|
|
027535 |
udev_iter = udev_enumerate_new(conf->udev);
|
|
|
027535 |
if (!udev_iter)
|
|
|
027535 |
- return 1;
|
|
|
027535 |
+ return -ENOMEM;
|
|
|
027535 |
|
|
|
027535 |
udev_enumerate_add_match_subsystem(udev_iter, "block");
|
|
|
027535 |
udev_enumerate_scan_devices(udev_iter);
|
|
|
027535 |
@@ -121,17 +118,20 @@ path_discovery (vector pathvec, struct c
|
|
|
027535 |
udevice = udev_device_new_from_syspath(conf->udev, devpath);
|
|
|
027535 |
if (!udevice) {
|
|
|
027535 |
condlog(4, "%s: no udev information", devpath);
|
|
|
027535 |
- r++;
|
|
|
027535 |
continue;
|
|
|
027535 |
}
|
|
|
027535 |
devtype = udev_device_get_devtype(udevice);
|
|
|
027535 |
- if(devtype && !strncmp(devtype, "disk", 4))
|
|
|
027535 |
- r += path_discover(pathvec, conf, udevice, flag);
|
|
|
027535 |
+ if(devtype && !strncmp(devtype, "disk", 4)) {
|
|
|
027535 |
+ total_paths++;
|
|
|
027535 |
+ if (path_discover(pathvec, conf,
|
|
|
027535 |
+ udevice, flag) == PATHINFO_OK)
|
|
|
027535 |
+ num_paths++;
|
|
|
027535 |
+ }
|
|
|
027535 |
udev_device_unref(udevice);
|
|
|
027535 |
}
|
|
|
027535 |
udev_enumerate_unref(udev_iter);
|
|
|
027535 |
- condlog(4, "Discovery status %d", r);
|
|
|
027535 |
- return r;
|
|
|
027535 |
+ condlog(4, "Discovered %d/%d paths", num_paths, total_paths);
|
|
|
027535 |
+ return (total_paths - num_paths);
|
|
|
027535 |
}
|
|
|
027535 |
|
|
|
027535 |
#define declare_sysfs_get_str(fname) \
|
|
|
027535 |
@@ -1021,7 +1021,7 @@ get_state (struct path * pp, int daemon)
|
|
|
027535 |
|
|
|
027535 |
if (!checker_selected(c)) {
|
|
|
027535 |
if (daemon) {
|
|
|
027535 |
- if (pathinfo(pp, conf->hwtable, DI_SYSFS) != 0) {
|
|
|
027535 |
+ if (pathinfo(pp, conf->hwtable, DI_SYSFS) != PATHINFO_OK) {
|
|
|
027535 |
condlog(3, "%s: couldn't get sysfs pathinfo",
|
|
|
027535 |
pp->dev);
|
|
|
027535 |
return PATH_UNCHECKED;
|
|
|
027535 |
@@ -1140,7 +1140,7 @@ pathinfo (struct path *pp, vector hwtabl
|
|
|
027535 |
int path_state;
|
|
|
027535 |
|
|
|
027535 |
if (!pp)
|
|
|
027535 |
- return 1;
|
|
|
027535 |
+ return PATHINFO_FAILED;
|
|
|
027535 |
|
|
|
027535 |
condlog(3, "%s: mask = 0x%x", pp->dev, mask);
|
|
|
027535 |
|
|
|
027535 |
@@ -1148,12 +1148,12 @@ pathinfo (struct path *pp, vector hwtabl
|
|
|
027535 |
* fetch info available in sysfs
|
|
|
027535 |
*/
|
|
|
027535 |
if (mask & DI_SYSFS && sysfs_pathinfo(pp))
|
|
|
027535 |
- return 1;
|
|
|
027535 |
+ return PATHINFO_FAILED;
|
|
|
027535 |
|
|
|
027535 |
if (mask & DI_BLACKLIST && mask & DI_SYSFS) {
|
|
|
027535 |
if (filter_device(conf->blist_device, conf->elist_device,
|
|
|
027535 |
pp->vendor_id, pp->product_id) > 0) {
|
|
|
027535 |
- return 2;
|
|
|
027535 |
+ return PATHINFO_SKIPPED;
|
|
|
027535 |
}
|
|
|
027535 |
}
|
|
|
027535 |
|
|
|
027535 |
@@ -1199,7 +1199,7 @@ pathinfo (struct path *pp, vector hwtabl
|
|
|
027535 |
if (mask & DI_BLACKLIST && mask & DI_WWID) {
|
|
|
027535 |
if (filter_wwid(conf->blist_wwid, conf->elist_wwid,
|
|
|
027535 |
pp->wwid) > 0) {
|
|
|
027535 |
- return 2;
|
|
|
027535 |
+ return PATHINFO_SKIPPED;
|
|
|
027535 |
}
|
|
|
027535 |
}
|
|
|
027535 |
|
|
|
027535 |
@@ -1213,7 +1213,7 @@ pathinfo (struct path *pp, vector hwtabl
|
|
|
027535 |
}
|
|
|
027535 |
}
|
|
|
027535 |
|
|
|
027535 |
- return 0;
|
|
|
027535 |
+ return PATHINFO_OK;
|
|
|
027535 |
|
|
|
027535 |
blank:
|
|
|
027535 |
/*
|
|
|
c896fb |
Index: multipath-tools-130222/libmultipath/discovery.h
|
|
|
027535 |
===================================================================
|
|
|
c896fb |
--- multipath-tools-130222.orig/libmultipath/discovery.h
|
|
|
c896fb |
+++ multipath-tools-130222/libmultipath/discovery.h
|
|
|
027535 |
@@ -24,6 +24,10 @@
|
|
|
027535 |
#define SCSI_COMMAND_TERMINATED 0x22
|
|
|
027535 |
#define SG_ERR_DRIVER_SENSE 0x08
|
|
|
027535 |
|
|
|
027535 |
+#define PATHINFO_OK 0
|
|
|
027535 |
+#define PATHINFO_FAILED 1
|
|
|
027535 |
+#define PATHINFO_SKIPPED 2
|
|
|
027535 |
+
|
|
|
027535 |
struct config;
|
|
|
027535 |
|
|
|
027535 |
int sysfs_get_dev (struct udev_device *udev, char * buff, size_t len);
|
|
|
c896fb |
Index: multipath-tools-130222/multipath/main.c
|
|
|
027535 |
===================================================================
|
|
|
c896fb |
--- multipath-tools-130222.orig/multipath/main.c
|
|
|
c896fb |
+++ multipath-tools-130222/multipath/main.c
|
|
|
c896fb |
@@ -343,7 +343,7 @@ configure (void)
|
|
|
027535 |
/* maximum info */
|
|
|
027535 |
di_flag = DI_ALL;
|
|
|
027535 |
|
|
|
027535 |
- if (path_discovery(pathvec, conf, di_flag))
|
|
|
027535 |
+ if (path_discovery(pathvec, conf, di_flag) < 0)
|
|
|
027535 |
goto out;
|
|
|
027535 |
|
|
|
027535 |
if (conf->verbosity > 2)
|
|
|
c896fb |
Index: multipath-tools-130222/multipathd/main.c
|
|
|
027535 |
===================================================================
|
|
|
c896fb |
--- multipath-tools-130222.orig/multipathd/main.c
|
|
|
c896fb |
+++ multipath-tools-130222/multipathd/main.c
|
|
|
c896fb |
@@ -1515,7 +1515,7 @@ configure (struct vectors * vecs, int st
|
|
|
027535 |
struct multipath * mpp;
|
|
|
027535 |
struct path * pp;
|
|
|
027535 |
vector mpvec;
|
|
|
027535 |
- int i;
|
|
|
027535 |
+ int i, ret;
|
|
|
027535 |
|
|
|
027535 |
if (!vecs->pathvec && !(vecs->pathvec = vector_alloc()))
|
|
|
027535 |
return 1;
|
|
|
c896fb |
@@ -1529,7 +1529,9 @@ configure (struct vectors * vecs, int st
|
|
|
027535 |
/*
|
|
|
027535 |
* probe for current path (from sysfs) and map (from dm) sets
|
|
|
027535 |
*/
|
|
|
027535 |
- path_discovery(vecs->pathvec, conf, DI_ALL);
|
|
|
027535 |
+ ret = path_discovery(vecs->pathvec, conf, DI_ALL);
|
|
|
027535 |
+ if (ret < 0)
|
|
|
027535 |
+ return 1;
|
|
|
027535 |
|
|
|
027535 |
vector_foreach_slot (vecs->pathvec, pp, i){
|
|
|
027535 |
if (filter_path(conf, pp) > 0){
|