|
|
d88bf6 |
---
|
|
|
d88bf6 |
libmpathpersist/mpath_persist.c | 43 +++++++++++++++++++++++++---------------
|
|
|
d88bf6 |
libmpathpersist/mpath_persist.h | 4 ++-
|
|
|
d88bf6 |
2 files changed, 30 insertions(+), 17 deletions(-)
|
|
|
d88bf6 |
|
|
|
d88bf6 |
Index: multipath-tools-130222/libmpathpersist/mpath_persist.c
|
|
|
d88bf6 |
===================================================================
|
|
|
d88bf6 |
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c
|
|
|
d88bf6 |
+++ multipath-tools-130222/libmpathpersist/mpath_persist.c
|
|
|
d88bf6 |
@@ -440,7 +440,7 @@ int mpath_prout_reg(struct multipath *mp
|
|
|
d88bf6 |
thread[i].param.rq_type = rq_type;
|
|
|
d88bf6 |
thread[i].param.paramp = paramp;
|
|
|
d88bf6 |
thread[i].param.noisy = noisy;
|
|
|
d88bf6 |
- thread[i].param.status = -1;
|
|
|
d88bf6 |
+ thread[i].param.status = MPATH_PR_SKIP;
|
|
|
d88bf6 |
|
|
|
d88bf6 |
condlog (3, "THRED ID [%d] INFO]", i);
|
|
|
d88bf6 |
condlog (3, "rq_servact=%d ", thread[i].param.rq_servact);
|
|
|
d88bf6 |
@@ -476,14 +476,17 @@ int mpath_prout_reg(struct multipath *mp
|
|
|
d88bf6 |
rc = pthread_create(&thread[count].id, &attr, mpath_prout_pthread_fn, (void *)(&thread[count].param));
|
|
|
d88bf6 |
if (rc){
|
|
|
d88bf6 |
condlog (0, "%s: failed to create thread %d", mpp->wwid, rc);
|
|
|
d88bf6 |
+ thread[count].param.status = MPATH_PR_THREAD_ERROR;
|
|
|
d88bf6 |
}
|
|
|
d88bf6 |
count = count +1;
|
|
|
d88bf6 |
}
|
|
|
d88bf6 |
}
|
|
|
d88bf6 |
for( i=0; i < active_pathcount ; i++){
|
|
|
d88bf6 |
- rc = pthread_join(thread[i].id, NULL);
|
|
|
d88bf6 |
- if (rc){
|
|
|
d88bf6 |
- condlog (0, "%s: Thread[%d] failed to join thread %d", mpp->wwid, i, rc);
|
|
|
d88bf6 |
+ if (thread[i].param.status != MPATH_PR_THREAD_ERROR) {
|
|
|
d88bf6 |
+ rc = pthread_join(thread[i].id, NULL);
|
|
|
d88bf6 |
+ if (rc){
|
|
|
d88bf6 |
+ condlog (0, "%s: Thread[%d] failed to join thread %d", mpp->wwid, i, rc);
|
|
|
d88bf6 |
+ }
|
|
|
d88bf6 |
}
|
|
|
d88bf6 |
if (!rollback && (thread[i].param.status == MPATH_PR_RESERV_CONFLICT)){
|
|
|
d88bf6 |
rollback = 1;
|
|
|
d88bf6 |
@@ -502,23 +505,27 @@ int mpath_prout_reg(struct multipath *mp
|
|
|
d88bf6 |
if (rollback && ((rq_servact == MPATH_PROUT_REG_SA) && sa_key != 0 )){
|
|
|
d88bf6 |
condlog (3, "%s: ERROR: initiating pr out rollback", mpp->wwid);
|
|
|
d88bf6 |
for( i=0 ; i < active_pathcount ; i++){
|
|
|
d88bf6 |
- if((thread[i].param.status == MPATH_PR_SUCCESS) &&
|
|
|
d88bf6 |
- ((pp->state == PATH_UP) || (pp->state == PATH_GHOST))){
|
|
|
d88bf6 |
+ if (thread[i].param.status == MPATH_PR_SUCCESS) {
|
|
|
d88bf6 |
memcpy(&thread[i].param.paramp->key, &thread[i].param.paramp->sa_key, 8);
|
|
|
d88bf6 |
memset(&thread[i].param.paramp->sa_key, 0, 8);
|
|
|
d88bf6 |
thread[i].param.status = MPATH_PR_SUCCESS;
|
|
|
d88bf6 |
rc = pthread_create(&thread[i].id, &attr, mpath_prout_pthread_fn,
|
|
|
d88bf6 |
- (void *)(&thread[count].param));
|
|
|
d88bf6 |
+ (void *)(&thread[i].param));
|
|
|
d88bf6 |
if (rc){
|
|
|
d88bf6 |
condlog (0, "%s: failed to create thread for rollback. %d", mpp->wwid, rc);
|
|
|
d88bf6 |
+ thread[i].param.status = MPATH_PR_THREAD_ERROR;
|
|
|
d88bf6 |
}
|
|
|
d88bf6 |
- }
|
|
|
d88bf6 |
+ } else
|
|
|
d88bf6 |
+ thread[i].param.status = MPATH_PR_SKIP;
|
|
|
d88bf6 |
}
|
|
|
d88bf6 |
for(i=0; i < active_pathcount ; i++){
|
|
|
d88bf6 |
- rc = pthread_join(thread[i].id, NULL);
|
|
|
d88bf6 |
- if (rc){
|
|
|
d88bf6 |
- condlog (3, "%s: failed to join thread while rolling back %d",
|
|
|
d88bf6 |
- mpp->wwid, i);
|
|
|
d88bf6 |
+ if (thread[i].param.status != MPATH_PR_SKIP &&
|
|
|
d88bf6 |
+ thread[i].param.status != MPATH_PR_THREAD_ERROR) {
|
|
|
d88bf6 |
+ rc = pthread_join(thread[i].id, NULL);
|
|
|
d88bf6 |
+ if (rc){
|
|
|
d88bf6 |
+ condlog (3, "%s: failed to join thread while rolling back %d",
|
|
|
d88bf6 |
+ mpp->wwid, i);
|
|
|
d88bf6 |
+ }
|
|
|
d88bf6 |
}
|
|
|
d88bf6 |
}
|
|
|
d88bf6 |
}
|
|
|
d88bf6 |
@@ -649,16 +656,20 @@ int mpath_prout_rel(struct multipath *mp
|
|
|
d88bf6 |
condlog (3, "%s: sending pr out command to %s", mpp->wwid, pp->dev);
|
|
|
d88bf6 |
rc = pthread_create (&thread[count].id, &attr, mpath_prout_pthread_fn,
|
|
|
d88bf6 |
(void *) (&thread[count].param));
|
|
|
d88bf6 |
- if (rc)
|
|
|
d88bf6 |
+ if (rc) {
|
|
|
d88bf6 |
condlog (0, "%s: failed to create thread. %d", mpp->wwid, rc);
|
|
|
d88bf6 |
+ thread[count].param.status = MPATH_PR_THREAD_ERROR;
|
|
|
d88bf6 |
+ }
|
|
|
d88bf6 |
count = count + 1;
|
|
|
d88bf6 |
}
|
|
|
d88bf6 |
}
|
|
|
d88bf6 |
pthread_attr_destroy (&attr);
|
|
|
d88bf6 |
for (i = 0; i < active_pathcount; i++){
|
|
|
d88bf6 |
- rc = pthread_join (thread[i].id, NULL);
|
|
|
d88bf6 |
- if (rc){
|
|
|
d88bf6 |
- condlog (1, "%s: failed to join thread. %d", mpp->wwid, rc);
|
|
|
d88bf6 |
+ if (thread[i].param.status != MPATH_PR_THREAD_ERROR) {
|
|
|
d88bf6 |
+ rc = pthread_join (thread[i].id, NULL);
|
|
|
d88bf6 |
+ if (rc){
|
|
|
d88bf6 |
+ condlog (1, "%s: failed to join thread. %d", mpp->wwid, rc);
|
|
|
d88bf6 |
+ }
|
|
|
d88bf6 |
}
|
|
|
d88bf6 |
}
|
|
|
d88bf6 |
|
|
|
d88bf6 |
Index: multipath-tools-130222/libmpathpersist/mpath_persist.h
|
|
|
d88bf6 |
===================================================================
|
|
|
d88bf6 |
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.h
|
|
|
d88bf6 |
+++ multipath-tools-130222/libmpathpersist/mpath_persist.h
|
|
|
d88bf6 |
@@ -43,6 +43,7 @@ extern "C" {
|
|
|
d88bf6 |
|
|
|
d88bf6 |
|
|
|
d88bf6 |
/* PR RETURN_STATUS */
|
|
|
d88bf6 |
+#define MPATH_PR_SKIP -1 /* skipping this path */
|
|
|
d88bf6 |
#define MPATH_PR_SUCCESS 0
|
|
|
d88bf6 |
#define MPATH_PR_SYNTAX_ERROR 1 /* syntax error or invalid parameter */
|
|
|
d88bf6 |
/* status for check condition */
|
|
|
d88bf6 |
@@ -59,7 +60,8 @@ extern "C" {
|
|
|
d88bf6 |
#define MPATH_PR_RESERV_CONFLICT 11 /* Reservation conflict on the device */
|
|
|
d88bf6 |
#define MPATH_PR_FILE_ERROR 12 /* file (device node) problems(e.g. not found)*/
|
|
|
d88bf6 |
#define MPATH_PR_DMMP_ERROR 13 /* DMMP related error.(e.g Error in getting dm info */
|
|
|
d88bf6 |
-#define MPATH_PR_OTHER 14 /*other error/warning has occurred(transport
|
|
|
d88bf6 |
+#define MPATH_PR_THREAD_ERROR 14 /* pthreads error (e.g. unable to create new thread) */
|
|
|
d88bf6 |
+#define MPATH_PR_OTHER 15 /*other error/warning has occurred(transport
|
|
|
d88bf6 |
or driver error) */
|
|
|
d88bf6 |
|
|
|
d88bf6 |
/* PR MASK */
|