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:08:40 +0000 (10:08 -0800)
commite491a67a00053471300dd7ef6466bb66ff68de3b
tree6f823d9a4a85b88ef0aae38f95f7d311ec48b2c2
parentfb2ec1e9a8ff955d4c6ef6a787ba8f8100b3a846
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