<font size=2 face="sans-serif">Hi, </font><tt><font size=2>Michael Wang</font></tt>
<br><font size=2 face="sans-serif"><br>
This patch looks well for me, </font><tt><font size=2>cleanup_lock() should
be called without</font></tt>
<br><font size=1>affected</font><tt><font size=2> by the return value of
h->fn().</font></tt>
<br>
<br><tt><font size=2>Regards,</font></tt>
<br><tt><font size=2>Tang</font></tt>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">发件人:    
    </font><font size=1 face="sans-serif">Michael Wang
<yun.wang@profitbricks.com></font>
<br><font size=1 color=#5f5f5f face="sans-serif">收件人:    
    </font><font size=1 face="sans-serif">christophe.varoqui@opensvc.com,
dm-devel@redhat.com, </font>
<br><font size=1 color=#5f5f5f face="sans-serif">日期:    
    </font><font size=1 face="sans-serif">2016/10/12
16:11</font>
<br><font size=1 color=#5f5f5f face="sans-serif">主题:    
   </font><font size=1 face="sans-serif">[dm-devel] [RFC]
unreleased lock after handler failure</font>
<br><font size=1 color=#5f5f5f face="sans-serif">发件人:    
   </font><font size=1 face="sans-serif">dm-devel-bounces@redhat.com</font>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>Hi, folks<br>
<br>
While we are testing with the latest multipathd, we encounter issue that
once<br>
'del map' failed, all the following operation will show 'error -1 receiving
packet'<br>
whatever how long the timeout has been set (we have applied the latest
fix which<br>
make sure the poll will last for 10 seconds).<br>
<br>
After some debugging we found that inside parse_cmd(), the pthread_cleanup_pop()<br>
rely on '!r' as indicator for locked or not, while this will be overwritten
if<br>
the handler return failed (1 in our case), and then the unlock will be
missed.<br>
<br>
After applied below fix the problem got solved, although the del map failed,
the<br>
other operation can still works.<br>
<br>
Could you please help to review whether this is really the problem to be
fixed<br>
like that?<br>
<br>
Regards,<br>
Michael Wang<br>
<br>
<br>
<br>
diff --git a/multipathd/cli.c b/multipathd/cli.c<br>
index e8a9384..50161be 100644<br>
--- a/multipathd/cli.c<br>
+++ b/multipathd/cli.c<br>
@@ -481,6 +481,7 @@ parse_cmd (char * cmd, char ** reply, int * len, void
* data, int timeout )<br>
                tmo.tv_sec = 0;<br>
        }<br>
        if (h->locked) {<br>
+               int locked = 0;<br>
                struct vectors
* vecs = (struct vectors *)data;<br>
 <br>
                pthread_cleanup_push(cleanup_lock,
&vecs->lock);<br>
@@ -491,10 +492,11 @@ parse_cmd (char * cmd, char ** reply, int * len,
void * data, int timeout )<br>
                    
   r = 0;<br>
                }<br>
                if (r == 0) {<br>
+                    
  locked = 1;<br>
                    
   pthread_testcancel();<br>
                    
   r = h->fn(cmdvec, reply, len, data);<br>
                }<br>
-               pthread_cleanup_pop(!r);<br>
+               pthread_cleanup_pop(locked);<br>
        } else<br>
                r = h->fn(cmdvec,
reply, len, data);<br>
        free_keys(cmdvec);<br>
<br>
--<br>
dm-devel mailing list<br>
dm-devel@redhat.com<br>
</font></tt><a href="https://www.redhat.com/mailman/listinfo/dm-devel"><tt><font size=2>https://www.redhat.com/mailman/listinfo/dm-devel</font></tt></a><tt><font size=2><br>
</font></tt>
<br>