<div dir="ltr">Thanks for the review,<div><br></div><div>Tested again and applied to master, branch-2.2</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 1, 2014 at 8:36 AM, Ben Pfaff <span dir="ltr">&lt;<a href="mailto:blp@nicira.com" target="_blank">blp@nicira.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Apr 29, 2014 at 11:06:29AM -0700, Alex Wang wrote:<br>
&gt; Commit 6b59b543 (ovs-thread: Use fair (but nonrecursive)<br>
&gt; rwlocks on glibc.) changed the rwlocks to nonrecursive,<br>
&gt; writer-biased lock.  It also made the following deadlock<br>
&gt; possible.<br>
&gt;<br>
&gt; Assume BFD is used on both end of a link.  Consider the<br>
&gt; following events:<br>
&gt; 1. Handler at one end received the BFD control packet with<br>
&gt;    POLL flag set while holding the read lock of &#39;xlate_rwlock&#39;.<br>
&gt;    Since a BFD control packet with FINAL flag set should be<br>
&gt;    sent back immediately, it calls the<br>
&gt;    ofproto_dpif_monitor_port_send_soon(), in which, it tries<br>
&gt;    to grab the &#39;monitor_mutex&#39;.<br>
&gt; 2. The main thread needs to configure the ofproto-dpif-xlate<br>
&gt;    module.  It tries to grab the write lock of &#39;xlate_rwlock&#39;<br>
&gt;    and is blocked by event 1.<br>
&gt; 3. The monitor thread, after acquired the &#39;monitor_mutex&#39;,<br>
&gt;    wants to acquire the read lock of &#39;xlate_rwlock&#39;.<br>
&gt;<br>
&gt; Since the rwlock is now writer-biased, the attempt of acquiring<br>
&gt; read lock in event 3 will be blocked by event 2.  This will<br>
&gt; subsequently cause the block of event 1, since monitor thread<br>
&gt; is holding the &#39;monitor_mutex&#39;.  So the deadlock happens.<br>
&gt;<br>
&gt; This commit resolves the above issue by removing the requirement of<br>
&gt; acquiring &#39;monitor_mutex&#39; in ofproto_dpif_monitor_port_send_soon().<br>
&gt;<br>
&gt; Signed-off-by: Alex Wang &lt;<a href="mailto:alexw@nicira.com">alexw@nicira.com</a>&gt;<br>
<br>
</div></div>Acked-by: Ben Pfaff &lt;<a href="mailto:blp@nicira.com">blp@nicira.com</a>&gt;<br>
</blockquote></div><br></div>