aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2009-08-23 20:40:19 +0000
committerRobert Watson <rwatson@FreeBSD.org>2009-08-23 20:40:19 +0000
commit77dfcdc44559d4bca03d156d87c2e214c6172c04 (patch)
tree83b839696bd918acacee8b38993abd3c6857a5fb /sys/contrib
parentbfdaa523828e5a7e690ec5d7e9b5353bef992d2f (diff)
downloadsrc-77dfcdc44559d4bca03d156d87c2e214c6172c04.tar.gz
src-77dfcdc44559d4bca03d156d87c2e214c6172c04.zip
Rework global locks for interface list and index management, correcting
several critical bugs, including race conditions and lock order issues: Replace the single rwlock, ifnet_lock, with two locks, an rwlock and an sxlock. Either can be held to stablize the lists and indexes, but both are required to write. This allows the list to be held stable in both network interrupt contexts and sleepable user threads across sleeping memory allocations or device driver interactions. As before, writes to the interface list must occur from sleepable contexts. Reviewed by: bz, julian MFC after: 3 days
Notes
Notes: svn path=/head/; revision=196481
Diffstat (limited to 'sys/contrib')
-rw-r--r--sys/contrib/altq/altq/altq_subr.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/contrib/altq/altq/altq_subr.c b/sys/contrib/altq/altq/altq_subr.c
index 32107e57d369..edacc0d4b1ee 100644
--- a/sys/contrib/altq/altq/altq_subr.c
+++ b/sys/contrib/altq/altq/altq_subr.c
@@ -462,8 +462,8 @@ tbr_timeout(arg)
s = splimp();
#endif
#if defined(__FreeBSD__) && (__FreeBSD_version >= 500000)
- IFNET_RLOCK();
- VNET_LIST_RLOCK();
+ IFNET_RLOCK_NOSLEEP();
+ VNET_LIST_RLOCK_NOSLEEP();
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
#endif
@@ -480,8 +480,8 @@ tbr_timeout(arg)
#if defined(__FreeBSD__) && (__FreeBSD_version >= 500000)
CURVNET_RESTORE();
}
- VNET_LIST_RUNLOCK();
- IFNET_RUNLOCK();
+ VNET_LIST_RUNLOCK_NOSLEEP();
+ IFNET_RUNLOCK_NOSLEEP();
#endif
splx(s);
if (active > 0)