[ovs-git] Open vSwitch: ofproto-dpif-monitor: Fix deadlock. (master)

dev at openvswitch.org dev at openvswitch.org
Fri May 2 20:04:01 UTC 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, master has been updated
       via  6d308b28c023e864925b1a6775b3b91d215e89bf (commit)
      from  73a9f3418e5ad987a1e2c52c63af1ad511ecc1cb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6d308b28c023e864925b1a6775b3b91d215e89bf
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=6d308b28c023e864925b1a6775b3b91d215e89bf
Author: Alex Wang <alexw at nicira.com>
		
ofproto-dpif-monitor: Fix deadlock.
		
Commit 6b59b543 (ovs-thread: Use fair (but nonrecursive)
rwlocks on glibc.) changed the rwlocks to nonrecursive,
writer-biased lock.  It also made the following deadlock
possible.

Assume BFD is used on both end of a link.  Consider the
following events:
1. Handler at one end received the BFD control packet with
   POLL flag set while holding the read lock of 'xlate_rwlock'.
   Since a BFD control packet with FINAL flag set should be
   sent back immediately, it calls the
   ofproto_dpif_monitor_port_send_soon(), in which, it tries
   to grab the 'monitor_mutex'.
2. The main thread needs to configure the ofproto-dpif-xlate
   module.  It tries to grab the write lock of 'xlate_rwlock'
   and is blocked by event 1.
3. The monitor thread, after acquired the 'monitor_mutex',
   wants to acquire the read lock of 'xlate_rwlock'.

Since the rwlock is now writer-biased, the attempt of acquiring
read lock in event 3 will be blocked by event 2.  This will
subsequently cause the block of event 1, since monitor thread
is holding the 'monitor_mutex'.  So the deadlock happens.

This commit resolves the above issue by removing the requirement of
acquiring 'monitor_mutex' in ofproto_dpif_monitor_port_send_soon().

Signed-off-by: Alex Wang <alexw at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>



-----------------------------------------------------------------------

Summary of changes:
 lib/guarded-list.h             |    5 ++
 ofproto/ofproto-dpif-monitor.c |  135 +++++++++++++++++++++++++++-------------
 ofproto/ofproto-dpif-monitor.h |    1 -
 ofproto/ofproto-dpif-xlate.c   |    6 +-
 4 files changed, 97 insertions(+), 50 deletions(-)


hooks/post-receive
-- 
Open vSwitch



More information about the git mailing list