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