ofproto-dpif-xlate: Avoid recursive acquisition of xlate_rwlock.
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Wed, 15 Jan 2014 18:06:40 +0000 (10:06 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 15 Jan 2014 18:14:52 +0000 (10:14 -0800)
commit5b53282ae495e073a0dd51f69f9eff143b629304
tree5b53ed0c9d9a3a389d142e4711a4d7f05f7ca217
parent03a9042a398401707c2f17f6a57e5a3ac9e47013
ofproto-dpif-xlate: Avoid recursive acquisition of xlate_rwlock.

Currently xlate_rwlock is recursively acquired.
(xlate_send_packet -> ofproto_dpif_execute_actions -> xlate_actions)
Due to writer-preference in rwlock implementations, this causes
deadlock if another thread tries to acquire the lock exclusively
behind us.

This change avoids the problem by making xlate_send_packet drop
the lock before calling ofproto_dpif_execute_actions.  This is the
simplest fix but opens a race window against port reconfigurations.
Given the way xlate_send_packet is currently used, the race does not
seem a big problem.  An alternative would be passing down the
"xlate_rwlock is held" info to ofproto_dpif_execute_actions.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto/ofproto-dpif-xlate.c