ofproto-dpif-xlate: Avoid recursively taking read side of ofgroup rwlock.
authorBen Pfaff <blp@nicira.com>
Sat, 22 Feb 2014 00:27:00 +0000 (16:27 -0800)
committerBen Pfaff <blp@nicira.com>
Sat, 22 Feb 2014 00:27:00 +0000 (16:27 -0800)
commit5a0702383b61d329f0640b5b4da4869a4b4f1384
treea873e5252ef024a1830ad47f1fcdac7a8b48c3ec
parentfb14862dcf197ed025a3a337ca47c2f5e9560c0d
ofproto-dpif-xlate: Avoid recursively taking read side of ofgroup rwlock.

With glibc, rwlocks by default allow recursive read-locking even if a
thread is blocked waiting for the write-lock.  POSIX allows such attempts
to deadlock, and it appears that the libc used in NetBSD, at least, does
deadlock.  ofproto-dpif-xlate could take the ofgroup rwlock recursively if
an ofgroup's actions caused the ofgroup to be executed again.  This commit
avoids that issue by preventing recursive translation of groups (the same
group or another group).  This is not the most user friendly solution,
but OpenFlow allows this restriction, and we can always remove the
restriction later (probably requiring more complicated code) if it
proves to be a real problem to real users.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
ofproto/ofproto-dpif-xlate.c
ofproto/ofproto-dpif.c
tests/ofproto-dpif.at