basebuilder_pel7x64builder0
4 years ago
18 changed files with 8066 additions and 0 deletions
@ -0,0 +1,268 @@
@@ -0,0 +1,268 @@
|
||||
--- |
||||
libmultipath/structs_vec.c | 103 +++++++++------------------------------------ |
||||
libmultipath/structs_vec.h | 6 ++ |
||||
multipathd/main.c | 50 +++++++++++++++++++++ |
||||
3 files changed, 75 insertions(+), 84 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/structs_vec.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/structs_vec.c |
||||
+++ multipath-tools-130222/libmultipath/structs_vec.c |
||||
@@ -103,7 +103,7 @@ orphan_paths (vector pathvec, struct mul |
||||
} |
||||
} |
||||
|
||||
-static void |
||||
+void |
||||
set_multipath_wwid (struct multipath * mpp) |
||||
{ |
||||
if (strlen(mpp->wwid)) |
||||
@@ -188,57 +188,36 @@ remove_maps_and_stop_waiters (struct vec |
||||
_remove_maps(vecs, STOP_WAITER); |
||||
} |
||||
|
||||
-static struct hwentry * |
||||
+void |
||||
extract_hwe_from_path(struct multipath * mpp) |
||||
{ |
||||
struct path * pp = NULL; |
||||
- int pg_num = -1, p_num = -1, i; |
||||
- struct pathgroup * pgp = NULL; |
||||
- |
||||
- condlog(3, "%s: searching paths for valid hwe", mpp->alias); |
||||
+ int i; |
||||
|
||||
- if (mpp && mpp->pg) { |
||||
- vector_foreach_slot(mpp->pg, pgp, i) { |
||||
- if (pgp->status == PGSTATE_ACTIVE || |
||||
- pgp->status == PGSTATE_ENABLED) { |
||||
- pg_num = i; |
||||
- break; |
||||
- } |
||||
- } |
||||
- if (pg_num >= 0) |
||||
- pgp = VECTOR_SLOT(mpp->pg, pg_num); |
||||
- } |
||||
+ if (mpp->hwe || !mpp->paths) |
||||
+ return; |
||||
|
||||
- if (pgp && pgp->paths) { |
||||
- vector_foreach_slot(pgp->paths, pp, i) { |
||||
- if (pp->dmstate == PSTATE_FAILED) |
||||
- continue; |
||||
- if (strlen(pp->vendor_id) > 0 && |
||||
- strlen(pp->product_id) > 0 && |
||||
- strlen(pp->rev) > 0) { |
||||
- p_num = i; |
||||
- break; |
||||
- } |
||||
+ condlog(3, "%s: searching paths for valid hwe", mpp->alias); |
||||
+ /* doing this in two passes seems like paranoia to me */ |
||||
+ vector_foreach_slot(mpp->paths, pp, i) { |
||||
+ if (pp->state != PATH_UP) |
||||
+ continue; |
||||
+ if (pp->hwe) { |
||||
+ mpp->hwe = pp->hwe; |
||||
+ return; |
||||
} |
||||
- if (p_num >= 0) |
||||
- pp = VECTOR_SLOT(pgp->paths, i); |
||||
} |
||||
- |
||||
- if (pp) { |
||||
- condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); |
||||
- condlog(3, "%s: product = %s", pp->dev, pp->product_id); |
||||
- condlog(3, "%s: rev = %s", pp->dev, pp->rev); |
||||
- if (!pp->hwe) { |
||||
- condlog(3, "searching hwtable"); |
||||
- pp->hwe = find_hwe(conf->hwtable, pp->vendor_id, |
||||
- pp->product_id, pp->rev); |
||||
+ vector_foreach_slot(mpp->paths, pp, i) { |
||||
+ if (pp->state == PATH_UP) |
||||
+ continue; |
||||
+ if (pp->hwe) { |
||||
+ mpp->hwe = pp->hwe; |
||||
+ return; |
||||
} |
||||
} |
||||
- |
||||
- return pp?pp->hwe:NULL; |
||||
} |
||||
|
||||
-static int |
||||
+int |
||||
update_multipath_table (struct multipath *mpp, vector pathvec) |
||||
{ |
||||
char params[PARAMS_SIZE] = {0}; |
||||
@@ -259,7 +238,7 @@ update_multipath_table (struct multipath |
||||
return 0; |
||||
} |
||||
|
||||
-static int |
||||
+int |
||||
update_multipath_status (struct multipath *mpp) |
||||
{ |
||||
char status[PARAMS_SIZE] = {0}; |
||||
@@ -371,21 +350,11 @@ __setup_multipath (struct vectors * vecs |
||||
goto out; |
||||
} |
||||
|
||||
- set_multipath_wwid(mpp); |
||||
- mpp->mpe = find_mpe(mpp->wwid); |
||||
- condlog(3, "%s: discover", mpp->alias); |
||||
- |
||||
if (update_multipath_strings(mpp, vecs->pathvec)) { |
||||
condlog(0, "%s: failed to setup multipath", mpp->alias); |
||||
goto out; |
||||
} |
||||
|
||||
- if (!mpp->hwe) |
||||
- mpp->hwe = extract_hwe_from_path(mpp); |
||||
- if (!mpp->hwe) { |
||||
- condlog(3, "%s: no hardware entry found, using defaults", |
||||
- mpp->alias); |
||||
- } |
||||
if (reset) { |
||||
select_rr_weight(mpp); |
||||
select_pgfailback(mpp); |
||||
@@ -402,36 +371,6 @@ out: |
||||
return 1; |
||||
} |
||||
|
||||
-extern struct multipath * |
||||
-add_map_without_path (struct vectors * vecs, char * alias) |
||||
-{ |
||||
- struct multipath * mpp = alloc_multipath(); |
||||
- |
||||
- if (!mpp || !alias) |
||||
- return NULL; |
||||
- |
||||
- mpp->alias = STRDUP(alias); |
||||
- |
||||
- if (setup_multipath(vecs, mpp)) |
||||
- return NULL; /* mpp freed in setup_multipath */ |
||||
- |
||||
- if (adopt_paths(vecs->pathvec, mpp, 1)) |
||||
- goto out; |
||||
- |
||||
- if (!vector_alloc_slot(vecs->mpvec)) |
||||
- goto out; |
||||
- |
||||
- vector_set_slot(vecs->mpvec, mpp); |
||||
- |
||||
- if (start_waiter_thread(mpp, vecs)) |
||||
- goto out; |
||||
- |
||||
- return mpp; |
||||
-out: |
||||
- remove_map(mpp, vecs, PURGE_VEC); |
||||
- return NULL; |
||||
-} |
||||
- |
||||
static void |
||||
find_existing_alias (struct multipath * mpp, |
||||
struct vectors *vecs) |
||||
Index: multipath-tools-130222/libmultipath/structs_vec.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/structs_vec.h |
||||
+++ multipath-tools-130222/libmultipath/structs_vec.h |
||||
@@ -31,11 +31,15 @@ void remove_map_and_stop_waiter (struct |
||||
void remove_maps (struct vectors * vecs); |
||||
void remove_maps_and_stop_waiters (struct vectors * vecs); |
||||
|
||||
-struct multipath * add_map_without_path (struct vectors * vecs, char * alias); |
||||
struct multipath * add_map_with_path (struct vectors * vecs, |
||||
struct path * pp, int add_vec); |
||||
int update_multipath (struct vectors *vecs, char *mapname, int reset); |
||||
void update_queue_mode_del_path(struct multipath *mpp); |
||||
void update_queue_mode_add_path(struct multipath *mpp); |
||||
|
||||
+void extract_hwe_from_path(struct multipath * mpp); |
||||
+void set_multipath_wwid (struct multipath * mpp); |
||||
+int update_multipath_table (struct multipath *mpp, vector pathvec); |
||||
+int update_multipath_status (struct multipath *mpp); |
||||
+ |
||||
#endif /* _STRUCTS_VEC_H */ |
||||
Index: multipath-tools-130222/multipathd/main.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipathd/main.c |
||||
+++ multipath-tools-130222/multipathd/main.c |
||||
@@ -273,6 +273,7 @@ retry: |
||||
mpp->flush_on_last_del = FLUSH_UNDEF; |
||||
mpp->action = ACT_RELOAD; |
||||
|
||||
+ extract_hwe_from_path(mpp); |
||||
if (setup_map(mpp, params, PARAMS_SIZE)) { |
||||
condlog(0, "%s: failed to setup new map in update", mpp->alias); |
||||
retries = -1; |
||||
@@ -296,6 +297,49 @@ fail: |
||||
return 0; |
||||
} |
||||
|
||||
+static struct multipath * |
||||
+add_map_without_path (struct vectors * vecs, char * alias) |
||||
+{ |
||||
+ struct multipath * mpp = alloc_multipath(); |
||||
+ |
||||
+ if (!mpp) |
||||
+ return NULL; |
||||
+ if (!alias) { |
||||
+ FREE(mpp); |
||||
+ return NULL; |
||||
+ } |
||||
+ |
||||
+ mpp->alias = STRDUP(alias); |
||||
+ |
||||
+ if (dm_get_info(mpp->alias, &mpp->dmi)) { |
||||
+ condlog(3, "%s: cannot access table", mpp->alias); |
||||
+ goto out; |
||||
+ } |
||||
+ set_multipath_wwid(mpp); |
||||
+ mpp->mpe = find_mpe(mpp->wwid); |
||||
+ |
||||
+ if (update_multipath_table(mpp, vecs->pathvec)) |
||||
+ goto out; |
||||
+ if (update_multipath_status(mpp)) |
||||
+ goto out; |
||||
+ |
||||
+ if (!vector_alloc_slot(vecs->mpvec)) |
||||
+ goto out; |
||||
+ |
||||
+ vector_set_slot(vecs->mpvec, mpp); |
||||
+ |
||||
+ if (update_map(mpp, vecs) != 0) /* map removed */ |
||||
+ return NULL; |
||||
+ |
||||
+ if (start_waiter_thread(mpp, vecs)) |
||||
+ goto out; |
||||
+ |
||||
+ return mpp; |
||||
+out: |
||||
+ remove_map(mpp, vecs, 1); |
||||
+ return NULL; |
||||
+} |
||||
+ |
||||
static int |
||||
uev_add_map (struct uevent * uev, struct vectors * vecs) |
||||
{ |
||||
@@ -569,6 +613,7 @@ rescan: |
||||
verify_paths(mpp, vecs, NULL); |
||||
mpp->flush_on_last_del = FLUSH_UNDEF; |
||||
mpp->action = ACT_RELOAD; |
||||
+ extract_hwe_from_path(mpp); |
||||
} else { |
||||
if (!should_multipath(pp, vecs->pathvec)) { |
||||
orphan_path(pp); |
||||
@@ -855,8 +900,11 @@ map_discovery (struct vectors * vecs) |
||||
return 1; |
||||
|
||||
vector_foreach_slot (vecs->mpvec, mpp, i) |
||||
- if (setup_multipath(vecs, mpp)) |
||||
+ if (update_multipath_table(mpp, vecs->pathvec) || |
||||
+ update_multipath_status(mpp)) { |
||||
+ remove_map(mpp, vecs, 1); |
||||
i--; |
||||
+ } |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
--- |
||||
libmultipath/discovery.c | 5 ++++- |
||||
libmultipath/discovery.h | 2 +- |
||||
2 files changed, 5 insertions(+), 2 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/discovery.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c |
||||
+++ multipath-tools-130222/libmultipath/discovery.c |
||||
@@ -749,7 +749,10 @@ do_inq(int sg_fd, int cmddt, int evpd, u |
||||
io_hdr.dxferp = resp; |
||||
io_hdr.cmdp = inqCmdBlk; |
||||
io_hdr.sbp = sense_b; |
||||
- io_hdr.timeout = DEF_TIMEOUT; |
||||
+ if (conf->checker_timeout) |
||||
+ io_hdr.timeout = conf->checker_timeout * 1000; |
||||
+ else |
||||
+ io_hdr.timeout = DEF_TIMEOUT; |
||||
|
||||
if (ioctl(sg_fd, SG_IO, &io_hdr) < 0) |
||||
return -1; |
||||
Index: multipath-tools-130222/libmultipath/discovery.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/discovery.h |
||||
+++ multipath-tools-130222/libmultipath/discovery.h |
||||
@@ -14,7 +14,7 @@ |
||||
#endif |
||||
|
||||
#ifndef DEF_TIMEOUT |
||||
-#define DEF_TIMEOUT 300000 |
||||
+#define DEF_TIMEOUT 60000 |
||||
#endif |
||||
|
||||
/* |
@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
|
||||
--- |
||||
multipathd/main.c | 6 ++---- |
||||
multipathd/uxclnt.c | 22 +++++++++++++--------- |
||||
2 files changed, 15 insertions(+), 13 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/multipathd/main.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipathd/main.c |
||||
+++ multipath-tools-130222/multipathd/main.c |
||||
@@ -2234,8 +2234,7 @@ main (int argc, char *argv[]) |
||||
conf->verbosity = atoi(optarg); |
||||
break; |
||||
case 'k': |
||||
- uxclnt(optarg); |
||||
- exit(0); |
||||
+ return(uxclnt(optarg)); |
||||
case 'B': |
||||
conf->bindings_read_only = 1; |
||||
break; |
||||
@@ -2256,8 +2255,7 @@ main (int argc, char *argv[]) |
||||
optind++; |
||||
} |
||||
c += snprintf(c, s + CMDSIZE - c, "\n"); |
||||
- uxclnt(s); |
||||
- exit(0); |
||||
+ return(uxclnt(s)); |
||||
} |
||||
|
||||
if (!logsink) |
||||
Index: multipath-tools-130222/multipathd/uxclnt.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipathd/uxclnt.c |
||||
+++ multipath-tools-130222/multipathd/uxclnt.c |
||||
@@ -74,20 +74,24 @@ static void process(int fd) |
||||
} |
||||
} |
||||
|
||||
-static void process_req(int fd, char * inbuf) |
||||
+static int process_req(int fd, char * inbuf) |
||||
{ |
||||
char *reply; |
||||
+ int ret; |
||||
|
||||
if (send_packet(fd, inbuf) != 0) { |
||||
printf("cannot send packet\n"); |
||||
- return; |
||||
+ return 1; |
||||
} |
||||
- if (recv_packet(fd, &reply) != 0) |
||||
+ if (recv_packet(fd, &reply) != 0) { |
||||
printf("error receiving packet\n"); |
||||
- else { |
||||
- printf("%s", reply); |
||||
- FREE(reply); |
||||
+ return 1; |
||||
} |
||||
+ printf("%s", reply); |
||||
+ ret = (strcmp(reply, "fail\n") == 0); |
||||
+ FREE(reply); |
||||
+ /* Need to do better about getting return value */ |
||||
+ return ret; |
||||
} |
||||
|
||||
/* |
||||
@@ -95,7 +99,7 @@ static void process_req(int fd, char * i |
||||
*/ |
||||
int uxclnt(char * inbuf) |
||||
{ |
||||
- int fd; |
||||
+ int fd, ret = 0; |
||||
|
||||
fd = mpath_connect(); |
||||
if (fd == -1) { |
||||
@@ -104,9 +108,9 @@ int uxclnt(char * inbuf) |
||||
} |
||||
|
||||
if (inbuf) |
||||
- process_req(fd, inbuf); |
||||
+ ret = process_req(fd, inbuf); |
||||
else |
||||
process(fd); |
||||
|
||||
- return 0; |
||||
+ return ret; |
||||
} |
@ -0,0 +1,104 @@
@@ -0,0 +1,104 @@
|
||||
--- |
||||
libmultipath/configure.c | 2 - |
||||
libmultipath/propsel.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++ |
||||
2 files changed, 59 insertions(+), 1 deletion(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/configure.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/configure.c |
||||
+++ multipath-tools-130222/libmultipath/configure.c |
||||
@@ -282,6 +282,7 @@ setup_map (struct multipath * mpp, char |
||||
select_pgpolicy(mpp); |
||||
select_selector(mpp); |
||||
select_features(mpp); |
||||
+ select_retain_hwhandler(mpp); |
||||
select_hwhandler(mpp); |
||||
select_rr_weight(mpp); |
||||
select_minio(mpp); |
||||
@@ -293,7 +294,6 @@ setup_map (struct multipath * mpp, char |
||||
select_fast_io_fail(mpp); |
||||
select_dev_loss(mpp); |
||||
select_reservation_key(mpp); |
||||
- select_retain_hwhandler(mpp); |
||||
select_deferred_remove(mpp); |
||||
select_delay_watch_checks(mpp); |
||||
select_delay_wait_checks(mpp); |
||||
Index: multipath-tools-130222/libmultipath/propsel.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/propsel.c |
||||
+++ multipath-tools-130222/libmultipath/propsel.c |
||||
@@ -19,6 +19,8 @@ |
||||
#include "discovery.h" |
||||
#include "prioritizers/alua_rtpg.h" |
||||
#include "prkey.h" |
||||
+#include "sysfs.h" |
||||
+#include "util.h" |
||||
#include <inttypes.h> |
||||
#include <libudev.h> |
||||
#include <mpath_persist.h> |
||||
@@ -317,9 +319,65 @@ select_features (struct multipath * mp) |
||||
return 0; |
||||
} |
||||
|
||||
+static int get_dh_state(struct path *pp, char *value, size_t value_len) |
||||
+{ |
||||
+ int ret; |
||||
+ struct udev_device *ud; |
||||
+ |
||||
+ if (pp->udev == NULL) |
||||
+ return -1; |
||||
+ |
||||
+ ud = udev_device_get_parent_with_subsystem_devtype(pp->udev, "scsi", |
||||
+ "scsi_device"); |
||||
+ if (ud == NULL) |
||||
+ return -1; |
||||
+ |
||||
+ ret = sysfs_attr_get_value(ud, "dh_state", value, value_len); |
||||
+ if (ret > 0) |
||||
+ strchop(value); |
||||
+ return ret; |
||||
+} |
||||
+ |
||||
+static int |
||||
+use_attached_hwhandler(struct multipath * mp) |
||||
+{ |
||||
+ int i; |
||||
+ struct path *pp; |
||||
+ int attached_hwhandler = 0; |
||||
+ /* dh_state is no longer than "detached" */ |
||||
+ char dh_state[10]; |
||||
+ |
||||
+ vector_foreach_slot (mp->paths, pp, i) { |
||||
+ if (get_dh_state(pp, dh_state, sizeof(dh_state)) > 0 && |
||||
+ strcmp(dh_state, "detached") != 0) { |
||||
+ if (!attached_hwhandler) { |
||||
+ if (asprintf(&mp->hwhandler, "1 %s", |
||||
+ dh_state) < 0) |
||||
+ return 0; |
||||
+ attached_hwhandler = 1; |
||||
+ /* if we find 2 different hardware handlers, disable |
||||
+ * retain_attached_hw_handler, and use the configured |
||||
+ * handler */ |
||||
+ } else if (strcmp(dh_state, &mp->hwhandler[2]) != 0) { |
||||
+ FREE(mp->hwhandler); |
||||
+ mp->hwhandler = NULL; |
||||
+ mp->retain_hwhandler = RETAIN_HWHANDLER_OFF; |
||||
+ condlog(0, "%s: retain_attached_hw_hander disabled (inconsistent handlers on paths)", mp->alias); |
||||
+ return 0; |
||||
+ } |
||||
+ } |
||||
+ } |
||||
+ return attached_hwhandler; |
||||
+} |
||||
+ |
||||
extern int |
||||
select_hwhandler (struct multipath * mp) |
||||
{ |
||||
+ if (mp->retain_hwhandler == RETAIN_HWHANDLER_ON && |
||||
+ use_attached_hwhandler(mp)) { |
||||
+ condlog(3, "%s: hwhandler = %s (setting: retained by kernel driver)", mp->alias, mp->hwhandler); |
||||
+ return 0; |
||||
+ } |
||||
if (mp->hwe && mp->hwe->hwhandler) { |
||||
mp->hwhandler = mp->hwe->hwhandler; |
||||
condlog(3, "%s: hwhandler = %s (controller setting)", |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
--- |
||||
libmpathpersist/mpath_persist.c | 11 +++++------ |
||||
1 file changed, 5 insertions(+), 6 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmpathpersist/mpath_persist.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c |
||||
+++ multipath-tools-130222/libmpathpersist/mpath_persist.c |
||||
@@ -524,10 +524,10 @@ int mpath_prout_reg(struct multipath *mp |
||||
if (!rollback && (thread[i].param.status == MPATH_PR_RESERV_CONFLICT)){ |
||||
rollback = 1; |
||||
sa_key = 0; |
||||
- for (i = 0; i < 8; ++i){ |
||||
- if (i > 0) |
||||
+ for (j = 0; j < 8; ++j){ |
||||
+ if (j > 0) |
||||
sa_key <<= 8; |
||||
- sa_key |= paramp->sa_key[i]; |
||||
+ sa_key |= paramp->sa_key[j]; |
||||
} |
||||
status = MPATH_PR_RESERV_CONFLICT ; |
||||
} |
||||
@@ -537,11 +537,10 @@ int mpath_prout_reg(struct multipath *mp |
||||
} |
||||
if (rollback && ((rq_servact == MPATH_PROUT_REG_SA) && sa_key != 0 )){ |
||||
condlog (3, "%s: ERROR: initiating pr out rollback", mpp->wwid); |
||||
+ memcpy(¶mp->key, ¶mp->sa_key, 8); |
||||
+ memset(¶mp->sa_key, 0, 8); |
||||
for( i=0 ; i < count ; i++){ |
||||
if (thread[i].param.status == MPATH_PR_SUCCESS) { |
||||
- memcpy(&thread[i].param.paramp->key, &thread[i].param.paramp->sa_key, 8); |
||||
- memset(&thread[i].param.paramp->sa_key, 0, 8); |
||||
- thread[i].param.status = MPATH_PR_SUCCESS; |
||||
rc = pthread_create(&thread[i].id, &attr, mpath_prout_pthread_fn, |
||||
(void *)(&thread[i].param)); |
||||
if (rc){ |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,215 @@
@@ -0,0 +1,215 @@
|
||||
--- |
||||
libmultipath/discovery.c | 10 ++++++-- |
||||
libmultipath/structs.h | 1 |
||||
libmultipath/structs_vec.c | 4 ++- |
||||
multipathd/main.c | 52 ++++++++++++++++++++++++++++++++------------- |
||||
4 files changed, 49 insertions(+), 18 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/discovery.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c |
||||
+++ multipath-tools-130222/libmultipath/discovery.c |
||||
@@ -1425,10 +1425,13 @@ pathinfo (struct path *pp, vector hwtabl |
||||
pp->fd = open(udev_device_get_devnode(pp->udev), O_RDONLY); |
||||
|
||||
if (pp->fd < 0) { |
||||
+ pp->missing_udev_info = INFO_REINIT; |
||||
condlog(4, "Couldn't open node for %s: %s", |
||||
pp->dev, strerror(errno)); |
||||
goto blank; |
||||
} |
||||
+ if (pp->missing_udev_info == INFO_REINIT) |
||||
+ pp->missing_udev_info = INFO_OK; |
||||
|
||||
if (mask & DI_SERIAL) |
||||
get_geometry(pp); |
||||
@@ -1443,8 +1446,11 @@ pathinfo (struct path *pp, vector hwtabl |
||||
|
||||
if (mask & DI_CHECKER) { |
||||
if (path_state == PATH_UP) { |
||||
- pp->chkrstate = pp->state = get_state(pp, 0, |
||||
- path_state); |
||||
+ int newstate = get_state(pp, 0, path_state); |
||||
+ if (newstate != PATH_PENDING || |
||||
+ pp->state == PATH_UNCHECKED || |
||||
+ pp->state == PATH_WILD) |
||||
+ pp->chkrstate = pp->state = newstate; |
||||
if (pp->state == PATH_UNCHECKED || |
||||
pp->state == PATH_WILD) |
||||
goto blank; |
||||
Index: multipath-tools-130222/libmultipath/structs.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/structs.h |
||||
+++ multipath-tools-130222/libmultipath/structs.h |
||||
@@ -184,6 +184,7 @@ enum marginal_path_states { |
||||
|
||||
enum missing_udev_info_states { |
||||
INFO_OK, |
||||
+ INFO_REINIT, |
||||
INFO_MISSING, |
||||
INFO_REQUESTED, |
||||
}; |
||||
Index: multipath-tools-130222/multipathd/main.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipathd/main.c |
||||
+++ multipath-tools-130222/multipathd/main.c |
||||
@@ -1381,7 +1381,7 @@ int update_path_groups(struct multipath |
||||
return 0; |
||||
} |
||||
|
||||
-void |
||||
+int |
||||
check_path (struct vectors * vecs, struct path * pp) |
||||
{ |
||||
int newstate; |
||||
@@ -1390,19 +1390,20 @@ check_path (struct vectors * vecs, struc |
||||
int disable_reinstate = 0; |
||||
int oldchkrstate = pp->chkrstate; |
||||
|
||||
- if (!pp->mpp && (pp->missing_udev_info != INFO_MISSING || |
||||
- pp->retriggers >= conf->retrigger_tries)) |
||||
- return; |
||||
+ if (!pp->mpp && pp->missing_udev_info != INFO_REINIT && |
||||
+ (pp->missing_udev_info != INFO_MISSING || |
||||
+ pp->retriggers >= conf->retrigger_tries)) |
||||
+ return 0; |
||||
|
||||
if (pp->tick && --pp->tick) |
||||
- return; /* don't check this path yet */ |
||||
+ return 0; /* don't check this path yet */ |
||||
|
||||
- if (!pp->mpp) { |
||||
+ if (!pp->mpp && pp->missing_udev_info == INFO_MISSING) { |
||||
pp->missing_udev_info = INFO_REQUESTED; |
||||
pp->retriggers++; |
||||
sysfs_attr_set_value(pp->udev, "uevent", "change", |
||||
strlen("change")); |
||||
- return; |
||||
+ return 0; |
||||
} |
||||
|
||||
/* |
||||
@@ -1412,6 +1413,21 @@ check_path (struct vectors * vecs, struc |
||||
pp->tick = conf->checkint; |
||||
|
||||
newstate = path_offline(pp); |
||||
+ if (!pp->mpp) { |
||||
+ if (newstate == PATH_UP && |
||||
+ pp->missing_udev_info == INFO_REINIT) { |
||||
+ int ret; |
||||
+ condlog(3, "%s: add missing path", pp->dev); |
||||
+ ret = pathinfo(pp, conf->hwtable, |
||||
+ DI_ALL | DI_BLACKLIST); |
||||
+ if (ret == PATHINFO_OK && strlen(pp->wwid)) { |
||||
+ ev_add_path(pp, vecs); |
||||
+ pp->tick = 1; |
||||
+ } else if (ret == PATHINFO_SKIPPED) |
||||
+ return -1; |
||||
+ } |
||||
+ return 0; |
||||
+ } |
||||
if (newstate == PATH_UP) |
||||
newstate = get_state(pp, 1, newstate); |
||||
else |
||||
@@ -1426,7 +1442,7 @@ check_path (struct vectors * vecs, struc |
||||
if (newstate == PATH_WILD || newstate == PATH_UNCHECKED) { |
||||
condlog(2, "%s: unusable path", pp->dev); |
||||
pathinfo(pp, conf->hwtable, 0); |
||||
- return; |
||||
+ return 0; |
||||
} |
||||
/* |
||||
* Async IO in flight. Keep the previous path state |
||||
@@ -1434,7 +1450,7 @@ check_path (struct vectors * vecs, struc |
||||
*/ |
||||
if (newstate == PATH_PENDING) { |
||||
pp->tick = 1; |
||||
- return; |
||||
+ return 0; |
||||
} |
||||
/* |
||||
* Synchronize with kernel state |
||||
@@ -1446,7 +1462,7 @@ check_path (struct vectors * vecs, struc |
||||
} |
||||
/* if update_multipath_strings orphaned the path, quit early */ |
||||
if (!pp->mpp) |
||||
- return; |
||||
+ return 0; |
||||
|
||||
if ((newstate == PATH_UP || newstate == PATH_GHOST) && |
||||
pp->io_err_disable_reinstate && need_io_err_check(pp)) { |
||||
@@ -1456,7 +1472,7 @@ check_path (struct vectors * vecs, struc |
||||
* be recoverd in time |
||||
*/ |
||||
pp->tick = 1; |
||||
- return; |
||||
+ return 0; |
||||
} |
||||
|
||||
if ((newstate == PATH_UP || newstate == PATH_GHOST) && |
||||
@@ -1464,7 +1480,7 @@ check_path (struct vectors * vecs, struc |
||||
if (pp->mpp && pp->mpp->nr_active > 0) { |
||||
pp->state = PATH_DELAYED; |
||||
pp->wait_checks--; |
||||
- return; |
||||
+ return 0; |
||||
} else |
||||
pp->wait_checks = 0; |
||||
} |
||||
@@ -1512,7 +1528,7 @@ check_path (struct vectors * vecs, struc |
||||
pp->mpp->failback_tick = 0; |
||||
|
||||
pp->mpp->stat_path_failures++; |
||||
- return; |
||||
+ return 0; |
||||
} |
||||
|
||||
if(newstate == PATH_UP || newstate == PATH_GHOST){ |
||||
@@ -1594,7 +1610,7 @@ check_path (struct vectors * vecs, struc |
||||
|
||||
|
||||
if (pp->mpp->wait_for_udev) |
||||
- return; |
||||
+ return 0; |
||||
/* |
||||
* path prio refreshing |
||||
*/ |
||||
@@ -1613,6 +1629,7 @@ check_path (struct vectors * vecs, struc |
||||
(chkr_new_path_up && followover_should_failback(pp))) |
||||
switch_pathgroup(pp->mpp); |
||||
} |
||||
+ return 0; |
||||
} |
||||
|
||||
static void * |
||||
@@ -1642,7 +1659,12 @@ checkerloop (void *ap) |
||||
|
||||
if (vecs->pathvec) { |
||||
vector_foreach_slot (vecs->pathvec, pp, i) { |
||||
- check_path(vecs, pp); |
||||
+ int rc = check_path(vecs, pp); |
||||
+ if (rc < 0) { |
||||
+ vector_del_slot(vecs->pathvec, i); |
||||
+ free_path(pp); |
||||
+ i--; |
||||
+ } |
||||
} |
||||
} |
||||
if (vecs->mpvec) { |
||||
Index: multipath-tools-130222/libmultipath/structs_vec.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/structs_vec.c |
||||
+++ multipath-tools-130222/libmultipath/structs_vec.c |
||||
@@ -274,9 +274,11 @@ void sync_paths(struct multipath *mpp, v |
||||
} |
||||
} |
||||
if (!found) { |
||||
- condlog(3, "%s dropped path %s", mpp->alias, pp->dev); |
||||
+ condlog(2, "%s dropped path %s", mpp->alias, pp->dev); |
||||
vector_del_slot(mpp->paths, i--); |
||||
orphan_path(pp); |
||||
+ memset(pp->wwid, 0, WWID_SIZE); |
||||
+ pp->missing_udev_info = INFO_REINIT; |
||||
} |
||||
} |
||||
update_mpp_paths(mpp, pathvec); |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
--- |
||||
multipath/multipath.rules | 1 + |
||||
1 file changed, 1 insertion(+) |
||||
|
||||
Index: multipath-tools-130222/multipath/multipath.rules |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipath/multipath.rules |
||||
+++ multipath-tools-130222/multipath/multipath.rules |
||||
@@ -15,6 +15,7 @@ LABEL="test_dev" |
||||
ENV{MPATH_SBIN_PATH}="/sbin" |
||||
TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin" |
||||
TEST!="/etc/multipath.conf", GOTO="check_kpartx" |
||||
+KERNEL=="dm-*", GOTO="check_kpartx" |
||||
|
||||
ACTION=="add", ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \ |
||||
PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \ |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,71 @@
@@ -0,0 +1,71 @@
|
||||
--- |
||||
libmultipath/structs_vec.c | 24 +++++++++++++++++------- |
||||
multipathd/main.c | 2 ++ |
||||
2 files changed, 19 insertions(+), 7 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/structs_vec.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/structs_vec.c |
||||
+++ multipath-tools-130222/libmultipath/structs_vec.c |
||||
@@ -312,24 +312,33 @@ update_multipath_strings (struct multipa |
||||
extern void |
||||
set_no_path_retry(struct multipath *mpp) |
||||
{ |
||||
- mpp->retry_tick = 0; |
||||
+ char is_queueing = 0; |
||||
+ |
||||
mpp->nr_active = pathcount(mpp, PATH_UP) + pathcount(mpp, PATH_GHOST); |
||||
- select_no_path_retry(mpp); |
||||
+ if (mpp->features && strstr(mpp->features, "queue_if_no_path")) |
||||
+ is_queueing = 1; |
||||
|
||||
switch (mpp->no_path_retry) { |
||||
case NO_PATH_RETRY_UNDEF: |
||||
break; |
||||
case NO_PATH_RETRY_FAIL: |
||||
- dm_queue_if_no_path(mpp->alias, 0); |
||||
+ if (is_queueing) |
||||
+ dm_queue_if_no_path(mpp->alias, 0); |
||||
break; |
||||
case NO_PATH_RETRY_QUEUE: |
||||
- dm_queue_if_no_path(mpp->alias, 1); |
||||
+ if (!is_queueing) |
||||
+ dm_queue_if_no_path(mpp->alias, 1); |
||||
break; |
||||
default: |
||||
- dm_queue_if_no_path(mpp->alias, 1); |
||||
- if (mpp->nr_active == 0) { |
||||
+ if (mpp->nr_active > 0) { |
||||
+ mpp->retry_tick = 0; |
||||
+ if (!is_queueing) |
||||
+ dm_queue_if_no_path(mpp->alias, 1); |
||||
+ } else if (is_queueing && mpp->retry_tick == 0) { |
||||
/* Enter retry mode */ |
||||
- mpp->retry_tick = mpp->no_path_retry * conf->checkint; |
||||
+ mpp->stat_queueing_timeouts++; |
||||
+ mpp->retry_tick = mpp->no_path_retry * |
||||
+ conf->checkint + 1; |
||||
condlog(1, "%s: Entering recovery mode: max_retries=%d", |
||||
mpp->alias, mpp->no_path_retry); |
||||
} |
||||
@@ -360,6 +369,7 @@ __setup_multipath (struct vectors * vecs |
||||
if (reset) { |
||||
select_rr_weight(mpp); |
||||
select_pgfailback(mpp); |
||||
+ select_no_path_retry(mpp); |
||||
set_no_path_retry(mpp); |
||||
select_pg_timeout(mpp); |
||||
select_flush_on_last_del(mpp); |
||||
Index: multipath-tools-130222/multipathd/main.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipathd/main.c |
||||
+++ multipath-tools-130222/multipathd/main.c |
||||
@@ -1464,6 +1464,8 @@ check_path (struct vectors * vecs, struc |
||||
if (!pp->mpp) |
||||
return 0; |
||||
|
||||
+ set_no_path_retry(pp->mpp); |
||||
+ |
||||
if ((newstate == PATH_UP || newstate == PATH_GHOST) && |
||||
pp->io_err_disable_reinstate && need_io_err_check(pp)) { |
||||
pp->state = PATH_SHAKY; |
@ -0,0 +1,67 @@
@@ -0,0 +1,67 @@
|
||||
--- |
||||
libmultipath/discovery.c | 15 +++++++++++++-- |
||||
libmultipath/pgpolicies.c | 2 +- |
||||
libmultipath/prioritizers/ana.c | 2 +- |
||||
3 files changed, 15 insertions(+), 4 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/discovery.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c |
||||
+++ multipath-tools-130222/libmultipath/discovery.c |
||||
@@ -1234,6 +1234,7 @@ get_state (struct path * pp, int daemon, |
||||
static int |
||||
get_prio (struct path * pp) |
||||
{ |
||||
+ int old_prio; |
||||
if (!pp) |
||||
return 0; |
||||
|
||||
@@ -1247,10 +1248,20 @@ get_prio (struct path * pp) |
||||
return 1; |
||||
} |
||||
} |
||||
+ old_prio = pp->priority; |
||||
pp->priority = prio_getprio(p, pp); |
||||
if (pp->priority < 0) { |
||||
- condlog(3, "%s: %s prio error", pp->dev, prio_name(p)); |
||||
- pp->priority = PRIO_UNDEF; |
||||
+ /* this changes pp->offline, but why not */ |
||||
+ int state = path_offline(pp); |
||||
+ |
||||
+ if (state == PATH_DOWN || state == PATH_PENDING) { |
||||
+ pp->priority = old_prio; |
||||
+ condlog(3, "%s: %s prio error in state %d, keeping prio = %d", pp->dev, prio_name(p), state, pp->priority); |
||||
+ } else { |
||||
+ condlog(3, "%s: %s prio error in state %d", |
||||
+ pp->dev, prio_name(p), state); |
||||
+ pp->priority = PRIO_UNDEF; |
||||
+ } |
||||
return 1; |
||||
} |
||||
condlog(3, "%s: %s prio = %u", |
||||
Index: multipath-tools-130222/libmultipath/pgpolicies.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/pgpolicies.c |
||||
+++ multipath-tools-130222/libmultipath/pgpolicies.c |
||||
@@ -308,7 +308,7 @@ extern int |
||||
group_by_prio (struct multipath * mp) |
||||
{ |
||||
int i; |
||||
- unsigned int prio; |
||||
+ int prio; |
||||
struct path * pp; |
||||
struct pathgroup * pgp; |
||||
|
||||
Index: multipath-tools-130222/libmultipath/prioritizers/ana.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/prioritizers/ana.c |
||||
+++ multipath-tools-130222/libmultipath/prioritizers/ana.c |
||||
@@ -165,7 +165,7 @@ int get_ana_info(struct path * pp, unsig |
||||
ana_log, ana_log_len); |
||||
pthread_cleanup_pop(1); |
||||
if (rc >= 0) |
||||
- condlog(3, "%s: ana state = %02x [%s]", pp->dev, rc, |
||||
+ condlog(4, "%s: ana state = %02x [%s]", pp->dev, rc, |
||||
aas_print_string(rc)); |
||||
return rc; |
||||
} |
@ -0,0 +1,67 @@
@@ -0,0 +1,67 @@
|
||||
--- |
||||
libmultipath/configure.c | 12 ++++++------ |
||||
libmultipath/discovery.c | 8 ++++++-- |
||||
multipathd/main.c | 1 + |
||||
3 files changed, 13 insertions(+), 8 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/discovery.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c |
||||
+++ multipath-tools-130222/libmultipath/discovery.c |
||||
@@ -1264,8 +1264,12 @@ get_prio (struct path * pp) |
||||
} |
||||
return 1; |
||||
} |
||||
- condlog(3, "%s: %s prio = %u", |
||||
- pp->dev, prio_name(p), pp->priority); |
||||
+ if (old_prio != PRIO_UNDEF && old_prio != pp->priority) |
||||
+ condlog(2, "%s: prio changed from %d to %d", pp->dev, |
||||
+ old_prio, pp->priority); |
||||
+ else |
||||
+ condlog(3, "%s: %s prio = %u", |
||||
+ pp->dev, prio_name(p), pp->priority); |
||||
return 0; |
||||
} |
||||
|
||||
Index: multipath-tools-130222/multipathd/main.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipathd/main.c |
||||
+++ multipath-tools-130222/multipathd/main.c |
||||
@@ -1370,6 +1370,7 @@ int update_prio(struct path *pp, int ref |
||||
|
||||
int update_path_groups(struct multipath *mpp, struct vectors *vecs, int refresh) |
||||
{ |
||||
+ condlog(2, "%s: updating path groups %d", mpp->alias, refresh); |
||||
if (reload_map(vecs, mpp, refresh)) |
||||
return 1; |
||||
|
||||
Index: multipath-tools-130222/libmultipath/configure.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/configure.c |
||||
+++ multipath-tools-130222/libmultipath/configure.c |
||||
@@ -453,12 +453,6 @@ select_action (struct multipath * mpp, v |
||||
return; |
||||
} |
||||
|
||||
- if (pathcount(mpp, PATH_UP) == 0) { |
||||
- mpp->action = ACT_NOTHING; |
||||
- condlog(3, "%s: set ACT_NOTHING (no usable path)", |
||||
- mpp->alias); |
||||
- return; |
||||
- } |
||||
if (force_reload) { |
||||
mpp->force_udev_reload = 1; |
||||
mpp->action = ACT_RELOAD; |
||||
@@ -466,6 +460,12 @@ select_action (struct multipath * mpp, v |
||||
mpp->alias); |
||||
return; |
||||
} |
||||
+ if (pathcount(mpp, PATH_UP) == 0) { |
||||
+ mpp->action = ACT_NOTHING; |
||||
+ condlog(3, "%s: set ACT_NOTHING (no usable path)", |
||||
+ mpp->alias); |
||||
+ return; |
||||
+ } |
||||
if (cmpp->size != mpp->size) { |
||||
mpp->force_udev_reload = 1; |
||||
mpp->action = ACT_RESIZE; |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
--- |
||||
libmultipath/discovery.c | 11 +++++++++-- |
||||
1 file changed, 9 insertions(+), 2 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/discovery.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c |
||||
+++ multipath-tools-130222/libmultipath/discovery.c |
||||
@@ -889,7 +889,7 @@ nvme_sysfs_pathinfo (struct path * pp) |
||||
{ |
||||
struct udev_device *parent; |
||||
const char *attr_path = NULL; |
||||
- |
||||
+ const char *attr; |
||||
|
||||
attr_path = udev_device_get_sysname(pp->udev); |
||||
if (!attr_path) |
||||
@@ -902,10 +902,17 @@ nvme_sysfs_pathinfo (struct path * pp) |
||||
pp->sg_id.channel = 0; |
||||
pp->sg_id.lun = 0; |
||||
|
||||
- parent = udev_device_get_parent(pp->udev); |
||||
+ parent = udev_device_get_parent_with_subsystem_devtype(pp->udev, |
||||
+ "nvme", NULL); |
||||
if (!parent) |
||||
return 1; |
||||
|
||||
+ attr = udev_device_get_sysattr_value(pp->udev, "nsid"); |
||||
+ pp->sg_id.lun = attr ? atoi(attr) : 0; |
||||
+ |
||||
+ attr = udev_device_get_sysattr_value(parent, "cntlid"); |
||||
+ pp->sg_id.channel = attr ? atoi(attr) : 0; |
||||
+ |
||||
snprintf(pp->vendor_id, SCSI_VENDOR_SIZE, "NVME"); |
||||
snprintf(pp->product_id, PATH_PRODUCT_SIZE, "%s", |
||||
udev_device_get_sysattr_value(parent, "model")); |
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
--- |
||||
libmultipath/hwtable.c | 13 +++++++++++++ |
||||
1 file changed, 13 insertions(+) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/hwtable.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/hwtable.c |
||||
+++ multipath-tools-130222/libmultipath/hwtable.c |
||||
@@ -748,6 +748,19 @@ static struct hwentry default_hw[] = { |
||||
.prio_name = PRIO_RDAC, |
||||
.prio_args = NULL, |
||||
}, |
||||
+ { |
||||
+ .vendor = "LENOVO", |
||||
+ .product = "DE_Series", |
||||
+ .bl_product = "Universal Xport", |
||||
+ .features = "2 pg_init_retries 50", |
||||
+ .hwhandler = "1 rdac", |
||||
+ .pgpolicy = GROUP_BY_PRIO, |
||||
+ .pgfailback = -FAILBACK_IMMEDIATE, |
||||
+ .no_path_retry = 30, |
||||
+ .checker_name = RDAC, |
||||
+ .prio_name = PRIO_RDAC, |
||||
+ .prio_args = NULL, |
||||
+ }, |
||||
/* |
||||
* NETAPP controller family |
||||
* |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,219 @@
@@ -0,0 +1,219 @@
|
||||
--- |
||||
libmultipath/checkers.c | 29 +++++++++++++++++++++++++++-- |
||||
libmultipath/checkers.h | 2 ++ |
||||
libmultipath/checkers/cciss_tur.c | 5 +++++ |
||||
libmultipath/checkers/directio.c | 5 +++++ |
||||
libmultipath/checkers/emc_clariion.c | 7 +++++++ |
||||
libmultipath/checkers/hp_sw.c | 5 +++++ |
||||
libmultipath/checkers/rdac.c | 5 +++++ |
||||
libmultipath/checkers/readsector0.c | 5 +++++ |
||||
libmultipath/checkers/tur.c | 5 +++++ |
||||
libmultipath/discovery.c | 2 ++ |
||||
10 files changed, 68 insertions(+), 2 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/checkers.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/checkers.c |
||||
+++ multipath-tools-130222/libmultipath/checkers.c |
||||
@@ -132,6 +132,13 @@ struct checker * add_checker (char * nam |
||||
if (!c->init) |
||||
goto out; |
||||
|
||||
+ c->mp_init = (int (*)(struct checker *)) dlsym(c->handle, "libcheck_mp_init"); |
||||
+ errstr = dlerror(); |
||||
+ if (errstr != NULL) |
||||
+ condlog(0, "A dynamic linking error occurred: (%s)", errstr); |
||||
+ if (!c->mp_init) |
||||
+ goto out; |
||||
+ |
||||
c->free = (void (*)(struct checker *)) dlsym(c->handle, "libcheck_free"); |
||||
errstr = dlerror(); |
||||
if (errstr != NULL) |
||||
@@ -189,8 +196,25 @@ int checker_init (struct checker * c, vo |
||||
if (!c) |
||||
return 1; |
||||
c->mpcontext = mpctxt_addr; |
||||
- if (c->init) |
||||
- return c->init(c); |
||||
+ if (c->init && c->init(c) != 0) |
||||
+ return 1; |
||||
+ if (mpctxt_addr && *mpctxt_addr == NULL && c->mp_init && |
||||
+ c->mp_init(c) != 0) /* for now, continue even if mp_init fails */ |
||||
+ c->mpcontext = NULL; |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
+int checker_mp_init(struct checker * c, void ** mpctxt_addr) |
||||
+{ |
||||
+ if (!c) |
||||
+ return 1; |
||||
+ if (c->mp_init && !c->mpcontext && mpctxt_addr) { |
||||
+ c->mpcontext = mpctxt_addr; |
||||
+ if (c->mp_init(c) != 0) { |
||||
+ c->mpcontext = NULL; |
||||
+ return 1; |
||||
+ } |
||||
+ } |
||||
return 0; |
||||
} |
||||
|
||||
@@ -277,6 +301,7 @@ void checker_get (struct checker * dst, |
||||
strncpy(dst->message, src->message, CHECKER_MSG_LEN); |
||||
dst->check = src->check; |
||||
dst->init = src->init; |
||||
+ dst->mp_init = src->mp_init; |
||||
dst->free = src->free; |
||||
dst->handle = NULL; |
||||
src->refcount++; |
||||
Index: multipath-tools-130222/libmultipath/checkers.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/checkers.h |
||||
+++ multipath-tools-130222/libmultipath/checkers.h |
||||
@@ -107,6 +107,7 @@ struct checker { |
||||
you want to stuff data in. */ |
||||
int (*check)(struct checker *); |
||||
int (*init)(struct checker *); /* to allocate the context */ |
||||
+ int (*mp_init)(struct checker *); /* to allocate the mpcontext */ |
||||
void (*free)(struct checker *); /* to free the context */ |
||||
}; |
||||
|
||||
@@ -118,6 +119,7 @@ void cleanup_checkers (void); |
||||
struct checker * add_checker (char *); |
||||
struct checker * checker_lookup (char *); |
||||
int checker_init (struct checker *, void **); |
||||
+int checker_mp_init (struct checker *, void **); |
||||
void checker_put (struct checker *); |
||||
void checker_reset (struct checker *); |
||||
void checker_set_sync (struct checker *); |
||||
Index: multipath-tools-130222/libmultipath/discovery.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c |
||||
+++ multipath-tools-130222/libmultipath/discovery.c |
||||
@@ -1217,6 +1217,8 @@ get_state (struct path * pp, int daemon, |
||||
return PATH_UNCHECKED; |
||||
} |
||||
} |
||||
+ if (pp->mpp && !c->mpcontext) |
||||
+ checker_mp_init(c, &pp->mpp->mpcontext); |
||||
checker_clear_message(c); |
||||
if (daemon) { |
||||
if (conf->force_sync == 0) |
||||
Index: multipath-tools-130222/libmultipath/checkers/cciss_tur.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/checkers/cciss_tur.c |
||||
+++ multipath-tools-130222/libmultipath/checkers/cciss_tur.c |
||||
@@ -58,6 +58,11 @@ int libcheck_init (struct checker * c) |
||||
return 0; |
||||
} |
||||
|
||||
+int libcheck_mp_init (struct checker * c) |
||||
+{ |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
void libcheck_free (struct checker * c) |
||||
{ |
||||
return; |
||||
Index: multipath-tools-130222/libmultipath/checkers/directio.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/checkers/directio.c |
||||
+++ multipath-tools-130222/libmultipath/checkers/directio.c |
||||
@@ -94,6 +94,11 @@ out: |
||||
return 1; |
||||
} |
||||
|
||||
+int libcheck_mp_init(struct checker * c) |
||||
+{ |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
void libcheck_free (struct checker * c) |
||||
{ |
||||
struct directio_context * ct = (struct directio_context *)c->context; |
||||
Index: multipath-tools-130222/libmultipath/checkers/emc_clariion.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/checkers/emc_clariion.c |
||||
+++ multipath-tools-130222/libmultipath/checkers/emc_clariion.c |
||||
@@ -73,11 +73,18 @@ int libcheck_init (struct checker * c) |
||||
return 1; |
||||
((struct emc_clariion_checker_path_context *)c->context)->wwn_set = 0; |
||||
|
||||
+ return 0; |
||||
+} |
||||
+ |
||||
+int libcheck_mp_init (struct checker * c) |
||||
+{ |
||||
/* |
||||
* Allocate and initialize the multi-path global context. |
||||
*/ |
||||
if (c->mpcontext && *c->mpcontext == NULL) { |
||||
void * mpctxt = malloc(sizeof(int)); |
||||
+ if (!mpctxt) |
||||
+ return 1; |
||||
*c->mpcontext = mpctxt; |
||||
CLR_INACTIVE_SNAP(c); |
||||
} |
||||
Index: multipath-tools-130222/libmultipath/checkers/hp_sw.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/checkers/hp_sw.c |
||||
+++ multipath-tools-130222/libmultipath/checkers/hp_sw.c |
||||
@@ -39,6 +39,11 @@ int libcheck_init (struct checker * c) |
||||
return 0; |
||||
} |
||||
|
||||
+int libcheck_mp_init(struct checker * c) |
||||
+{ |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
void libcheck_free (struct checker * c) |
||||
{ |
||||
return; |
||||
Index: multipath-tools-130222/libmultipath/checkers/rdac.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/checkers/rdac.c |
||||
+++ multipath-tools-130222/libmultipath/checkers/rdac.c |
||||
@@ -134,6 +134,11 @@ out: |
||||
return 0; |
||||
} |
||||
|
||||
+int libcheck_mp_init(struct checker * c) |
||||
+{ |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
void libcheck_free (struct checker * c) |
||||
{ |
||||
return; |
||||
Index: multipath-tools-130222/libmultipath/checkers/readsector0.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/checkers/readsector0.c |
||||
+++ multipath-tools-130222/libmultipath/checkers/readsector0.c |
||||
@@ -18,6 +18,11 @@ int libcheck_init (struct checker * c) |
||||
return 0; |
||||
} |
||||
|
||||
+int libcheck_mp_init(struct checker * c) |
||||
+{ |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
void libcheck_free (struct checker * c) |
||||
{ |
||||
return; |
||||
Index: multipath-tools-130222/libmultipath/checkers/tur.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/checkers/tur.c |
||||
+++ multipath-tools-130222/libmultipath/checkers/tur.c |
||||
@@ -158,6 +158,11 @@ int libcheck_init (struct checker * c) |
||||
return 0; |
||||
} |
||||
|
||||
+int libcheck_mp_init(struct checker * c) |
||||
+{ |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
void cleanup_context(struct tur_checker_context *ct) |
||||
{ |
||||
pthread_mutex_destroy(&ct->lock); |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
--- |
||||
libmultipath/hwtable.c | 8 ++++++++ |
||||
1 file changed, 8 insertions(+) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/hwtable.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/hwtable.c |
||||
+++ multipath-tools-130222/libmultipath/hwtable.c |
||||
@@ -1194,6 +1194,14 @@ static struct hwentry default_hw[] = { |
||||
.detect_prio = DETECT_PRIO_ON, |
||||
.checker_name = NONE, |
||||
}, |
||||
+ { |
||||
+ .vendor = "NVME", |
||||
+ .product = "^EMC PowerMax_", |
||||
+ .uid_attribute = "ID_WWN", |
||||
+ .pgpolicy = MULTIBUS, |
||||
+ .checker_name = NONE, |
||||
+ .prio_name = DEFAULT_PRIO, |
||||
+ }, |
||||
/* |
||||
* EOL |
||||
*/ |
@ -0,0 +1,136 @@
@@ -0,0 +1,136 @@
|
||||
--- |
||||
libmpathpersist/mpath_persist.c | 2 +- |
||||
mpathpersist/main.c | 36 ++++++++++++++++++++++-------------- |
||||
2 files changed, 23 insertions(+), 15 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/mpathpersist/main.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/mpathpersist/main.c |
||||
+++ multipath-tools-130222/mpathpersist/main.c |
||||
@@ -141,7 +141,8 @@ static int do_batch_file(const char *bat |
||||
|
||||
static int handle_args(int argc, char * argv[], int nline) |
||||
{ |
||||
- int fd, c; |
||||
+ int c; |
||||
+ int fd = -1; |
||||
const char *device_name = NULL; |
||||
int num_prin_sa = 0; |
||||
int num_prout_sa = 0; |
||||
@@ -199,7 +200,8 @@ static int handle_args(int argc, char * |
||||
if (nline == 0 && 1 != sscanf (optarg, "%d", &loglevel)) |
||||
{ |
||||
fprintf (stderr, "bad argument to '--verbose'\n"); |
||||
- return MPATH_PR_SYNTAX_ERROR; |
||||
+ ret = MPATH_PR_SYNTAX_ERROR; |
||||
+ goto out; |
||||
} |
||||
break; |
||||
|
||||
@@ -214,6 +216,7 @@ static int handle_args(int argc, char * |
||||
|
||||
case 'h': |
||||
usage (); |
||||
+ free(batch_fn); |
||||
return 0; |
||||
|
||||
case 'H': |
||||
@@ -236,7 +239,8 @@ static int handle_args(int argc, char * |
||||
if (parse_prkey(optarg, ¶m_rk) != 0) |
||||
{ |
||||
fprintf (stderr, "bad argument to '--param-rk'\n"); |
||||
- return MPATH_PR_SYNTAX_ERROR; |
||||
+ ret = MPATH_PR_SYNTAX_ERROR; |
||||
+ goto out; |
||||
} |
||||
++num_prout_param; |
||||
break; |
||||
@@ -245,7 +249,8 @@ static int handle_args(int argc, char * |
||||
if (parse_prkey(optarg, ¶m_sark) != 0) |
||||
{ |
||||
fprintf (stderr, "bad argument to '--param-sark'\n"); |
||||
- return MPATH_PR_SYNTAX_ERROR; |
||||
+ ret = MPATH_PR_SYNTAX_ERROR; |
||||
+ goto out; |
||||
} |
||||
++num_prout_param; |
||||
break; |
||||
@@ -264,7 +269,8 @@ static int handle_args(int argc, char * |
||||
if (1 != sscanf (optarg, "%x", &prout_type)) |
||||
{ |
||||
fprintf (stderr, "bad argument to '--prout-type'\n"); |
||||
- return MPATH_PR_SYNTAX_ERROR; |
||||
+ ret = MPATH_PR_SYNTAX_ERROR; |
||||
+ goto out; |
||||
} |
||||
++num_prout_param; |
||||
break; |
||||
@@ -312,7 +318,8 @@ static int handle_args(int argc, char * |
||||
case 'X': |
||||
if (0 != construct_transportid(optarg, transportids, num_transport)) { |
||||
fprintf(stderr, "bad argument to '--transport-id'\n"); |
||||
- return MPATH_PR_SYNTAX_ERROR; |
||||
+ ret = MPATH_PR_SYNTAX_ERROR; |
||||
+ goto out; |
||||
} |
||||
|
||||
++num_transport; |
||||
@@ -320,12 +327,13 @@ static int handle_args(int argc, char * |
||||
|
||||
case 'l': |
||||
if (1 != sscanf(optarg, "%u", &mpath_mx_alloc_len)) { |
||||
- fprintf(stderr, "bad argument to '--alloc-length'\n"); |
||||
- return MPATH_PR_SYNTAX_ERROR; |
||||
+ fprintf(stderr, "bad argument to '--alloc-length'\n"); |
||||
+ ret = MPATH_PR_SYNTAX_ERROR; |
||||
+ goto out; |
||||
} else if (MPATH_MAX_PARAM_LEN < mpath_mx_alloc_len) { |
||||
- fprintf(stderr, "'--alloc-length' argument exceeds maximum" |
||||
- " limit(%d)\n", MPATH_MAX_PARAM_LEN); |
||||
- return MPATH_PR_SYNTAX_ERROR; |
||||
+ fprintf(stderr, "'--alloc-length' argument exceeds maximum limit(%d)\n", MPATH_MAX_PARAM_LEN); |
||||
+ ret = MPATH_PR_SYNTAX_ERROR; |
||||
+ goto out; |
||||
} |
||||
break; |
||||
|
||||
@@ -465,14 +473,14 @@ static int handle_args(int argc, char * |
||||
{ |
||||
fprintf (stderr, "failed to allocate PRIN response buffer\n"); |
||||
ret = MPATH_PR_OTHER; |
||||
- goto out; |
||||
+ goto out_fd; |
||||
} |
||||
|
||||
ret = __mpath_persistent_reserve_in (fd, prin_sa, resp, noisy); |
||||
if (ret != MPATH_PR_SUCCESS ) |
||||
{ |
||||
fprintf (stderr, "Persistent Reserve IN command failed\n"); |
||||
- goto out; |
||||
+ goto out_fd; |
||||
} |
||||
|
||||
switch(prin_sa) |
||||
@@ -552,8 +560,8 @@ static int handle_args(int argc, char * |
||||
printf("PR out: command failed\n"); |
||||
} |
||||
|
||||
+out_fd: |
||||
close (fd); |
||||
- |
||||
out : |
||||
if (ret == MPATH_PR_SYNTAX_ERROR) { |
||||
free(batch_fn); |
||||
Index: multipath-tools-130222/libmpathpersist/mpath_persist.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c |
||||
+++ multipath-tools-130222/libmpathpersist/mpath_persist.c |
||||
@@ -585,7 +585,7 @@ int mpath_prout_common(struct multipath |
||||
return ret ; |
||||
} |
||||
} |
||||
- return MPATH_PR_SUCCESS; |
||||
+ return MPATH_PR_DMMP_ERROR; |
||||
} |
||||
|
||||
int send_prout_activepath(char * dev, int rq_servact, int rq_scope, |
Loading…
Reference in new issue