summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_gif.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-08-23 20:40:19 +0000
committerrwatson <rwatson@FreeBSD.org>2009-08-23 20:40:19 +0000
commitef8d755d4df716bf13f8a1833f7dd1db0b78c569 (patch)
tree83b839696bd918acacee8b38993abd3c6857a5fb /sys/netgraph/ng_gif.c
parent3d8e6186e2a82569f4f5214f8c8af700e5e36c13 (diff)
downloadFreeBSD-src-ef8d755d4df716bf13f8a1833f7dd1db0b78c569.zip
FreeBSD-src-ef8d755d4df716bf13f8a1833f7dd1db0b78c569.tar.gz
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
Diffstat (limited to 'sys/netgraph/ng_gif.c')
-rw-r--r--sys/netgraph/ng_gif.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/netgraph/ng_gif.c b/sys/netgraph/ng_gif.c
index ccff05a..1790cbd 100644
--- a/sys/netgraph/ng_gif.c
+++ b/sys/netgraph/ng_gif.c
@@ -560,7 +560,7 @@ ng_gif_mod_event(module_t mod, int event, void *data)
ng_gif_input_orphan_p = ng_gif_input_orphan;
/* Create nodes for any already-existing gif interfaces */
- VNET_LIST_RLOCK_NOSLEEP();
+ VNET_LIST_RLOCK();
IFNET_RLOCK();
VNET_FOREACH(vnet_iter) {
CURVNET_SET_QUIET(vnet_iter); /* XXX revisit quiet */
@@ -571,7 +571,7 @@ ng_gif_mod_event(module_t mod, int event, void *data)
CURVNET_RESTORE();
}
IFNET_RUNLOCK();
- VNET_LIST_RUNLOCK_NOSLEEP();
+ VNET_LIST_RUNLOCK();
break;
case MOD_UNLOAD:
OpenPOWER on IntegriCloud