netdev: Change netdev_class_rwlock to recursive mutex, for POSIX safety.
authorBen Pfaff <blp@nicira.com>
Wed, 15 Jan 2014 20:59:16 +0000 (12:59 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 19 Feb 2014 22:50:57 +0000 (14:50 -0800)
commitda695497b81f40f60b93116d4bfbf37505b7677c
tree6f7abcefd976865d67dbcb9d7b648fdd4f223cbe
parent090fd77e07b028c3775ce547db45d46459c39208
netdev: Change netdev_class_rwlock to recursive mutex, for POSIX safety.

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.  The netdev_class_rwlock is in fact acquired recursively in this
way, which is a bug.  This commit fixes the problem by switching to a
recursive mutex.  This allows for less parallelism, but according to an
existing comment that doesn't matter here anyway.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
lib/netdev.c