Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F135599854
D28530.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D28530.diff
View Options
diff --git a/sys/net/if.h b/sys/net/if.h
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -604,6 +604,9 @@
MALLOC_DECLARE(M_IFADDR);
MALLOC_DECLARE(M_IFMADDR);
#endif
+
+extern struct sx ifnet_detach_sxlock;
+
#endif
#ifndef _KERNEL
diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -315,7 +315,8 @@
SX_SYSINIT_FLAGS(ifnet_sx, &ifnet_sxlock, "ifnet_sx", SX_RECURSE);
struct sx ifnet_detach_sxlock;
-SX_SYSINIT(ifnet_detach, &ifnet_detach_sxlock, "ifnet_detach_sx");
+SX_SYSINIT_FLAGS(ifnet_detach, &ifnet_detach_sxlock, "ifnet_detach_sx",
+ SX_RECURSE);
/*
* The allocation of network interfaces is a rather non-atomic affair; we
@@ -546,9 +547,7 @@
IFNET_WUNLOCK();
for (int j = 0; j < i; j++) {
- sx_xlock(&ifnet_detach_sxlock);
if_vmove(pending[j], pending[j]->if_home_vnet);
- sx_xunlock(&ifnet_detach_sxlock);
}
free(pending, M_IFNET);
@@ -1124,9 +1123,9 @@
CURVNET_SET_QUIET(ifp->if_vnet);
found = if_unlink_ifnet(ifp, false);
if (found) {
- sx_slock(&ifnet_detach_sxlock);
+ sx_xlock(&ifnet_detach_sxlock);
if_detach_internal(ifp, 0, NULL);
- sx_sunlock(&ifnet_detach_sxlock);
+ sx_xunlock(&ifnet_detach_sxlock);
}
CURVNET_RESTORE();
}
@@ -3015,9 +3014,9 @@
error = priv_check(td, PRIV_NET_IFDESTROY);
if (error == 0) {
- sx_slock(&ifnet_detach_sxlock);
+ sx_xlock(&ifnet_detach_sxlock);
error = if_clone_destroy(ifr->ifr_name);
- sx_sunlock(&ifnet_detach_sxlock);
+ sx_xunlock(&ifnet_detach_sxlock);
}
goto out_noref;
diff --git a/sys/net/vnet.c b/sys/net/vnet.c
--- a/sys/net/vnet.c
+++ b/sys/net/vnet.c
@@ -283,7 +283,9 @@
vnet->vnet_shutdown = true;
CURVNET_SET_QUIET(vnet);
+ sx_xlock(&ifnet_detach_sxlock);
vnet_sysuninit();
+ sx_xunlock(&ifnet_detach_sxlock);
CURVNET_RESTORE();
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 12, 4:51 AM (3 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25194160
Default Alt Text
D28530.diff (1 KB)
Attached To
Mode
D28530: Widen ifnet_detach_sxlock coverage
Attached
Detach File
Event Timeline
Log In to Comment