<div dir="ltr">Merged.<div>Thanks.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 13, 2017 at 7:44 AM, Benjamin Marzinski <span dir="ltr"><<a href="mailto:bmarzins@redhat.com" target="_blank">bmarzins@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">when mpathpersist goes to rollback reservations, it doesn't do a<br>
rollback (and thus doesn't create a pthread) on paths that didn't<br>
successfully create a reservation in the first place. It also doesn't<br>
do any rollbacks at all if the last path in the multipath device was down,<br>
which is completely broken. However it still tries to join these<br>
non-existant pthreads, causing crashes.  To fix this, set the status to<br>
-1 (now MPATH_PR_SKIP) on threadinfos that don't get rollbacks, and<br>
remove the broken path state checking.<br>
<br>
Signed-off-by: Benjamin Marzinski <<a href="mailto:bmarzins@redhat.com">bmarzins@redhat.com</a>><br>
---<br>
 libmpathpersist/mpath_persist.<wbr>c | 13 +++++++------<br>
 libmpathpersist/mpath_persist.<wbr>h |  1 +<br>
 2 files changed, 8 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/libmpathpersist/mpath_<wbr>persist.c b/libmpathpersist/mpath_<wbr>persist.c<br>
index bf06efe..7fd4cb8 100644<br>
--- a/libmpathpersist/mpath_<wbr>persist.c<br>
+++ b/libmpathpersist/mpath_<wbr>persist.c<br>
@@ -481,7 +481,7 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,<br>
                thread[i].param.rq_type = rq_type;<br>
                thread[i].param.paramp = paramp;<br>
                thread[i].param.noisy = noisy;<br>
-               thread[i].param.status = -1;<br>
+               thread[i].param.status = MPATH_PR_SKIP;<br>
<br>
                condlog (3, "THRED ID [%d] INFO]", i);<br>
                condlog (3, "rq_servact=%d ", thread[i].param.rq_servact);<br>
@@ -548,8 +548,7 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,<br>
        if (rollback && ((rq_servact == MPATH_PROUT_REG_SA) && sa_key != 0 )){<br>
                condlog (3, "%s: ERROR: initiating pr out rollback", mpp->wwid);<br>
                for( i=0 ; i < active_pathcount ; i++){<br>
-                       if((thread[i].param.status == MPATH_PR_SUCCESS) &&<br>
-                                       ((pp->state == PATH_UP) || (pp->state == PATH_GHOST))){<br>
+                       if(thread[i].param.status == MPATH_PR_SUCCESS) {<br>
                                memcpy(&thread[i].param.<wbr>paramp->key, &thread[i].param.paramp->sa_<wbr>key, 8);<br>
                                memset(&thread[i].param.<wbr>paramp->sa_key, 0, 8);<br>
                                thread[i].param.status = MPATH_PR_SUCCESS;<br>
@@ -559,10 +558,12 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,<br>
                                        condlog (0, "%s: failed to create thread for rollback. %d",  mpp->wwid, rc);<br>
                                        thread[i].param.status = MPATH_PR_THREAD_ERROR;<br>
                                }<br>
-                       }<br>
+                       } else<br>
+                               thread[i].param.status = MPATH_PR_SKIP;<br>
                }<br>
                for(i=0; i < active_pathcount ; i++){<br>
-                       if (thread[i].param.status != MPATH_PR_THREAD_ERROR) {<br>
+                       if (thread[i].param.status != MPATH_PR_SKIP &&<br>
+                           thread[i].param.status != MPATH_PR_THREAD_ERROR) {<br>
                                rc = pthread_join(thread[i].id, NULL);<br>
                                if (rc){<br>
                                        condlog (3, "%s: failed to join thread while rolling back %d",<br>
@@ -676,7 +677,7 @@ int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope,<br>
                thread[i].param.rq_type = rq_type;<br>
                thread[i].param.paramp = paramp;<br>
                thread[i].param.noisy = noisy;<br>
-               thread[i].param.status = -1;<br>
+               thread[i].param.status = MPATH_PR_SKIP;<br>
<br>
                condlog (3, " path count = %d", i);<br>
                condlog (3, "rq_servact=%d ", thread[i].param.rq_servact);<br>
diff --git a/libmpathpersist/mpath_<wbr>persist.h b/libmpathpersist/mpath_<wbr>persist.h<br>
index 0f95943..1a34ce7 100644<br>
--- a/libmpathpersist/mpath_<wbr>persist.h<br>
+++ b/libmpathpersist/mpath_<wbr>persist.h<br>
@@ -43,6 +43,7 @@ extern "C" {<br>
<br>
<br>
 /* PR RETURN_STATUS */<br>
+#define MPATH_PR_SKIP                  -1  /* skipping this path */<br>
 #define MPATH_PR_SUCCESS               0<br>
 #define MPATH_PR_SYNTAX_ERROR          1   /*  syntax error or invalid parameter */<br>
                                            /* status for check condition */<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.1<br>
<br>
</font></span></blockquote></div><br></div>