Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177233073
D55832.1793978391.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D55832.1793978391.diff
View Options
diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1199,14 +1199,13 @@
sx_sunlock(&allprison_lock);
if (pr == NULL)
return (ENXIO);
- prison_hold_locked(pr);
- mtx_unlock(&pr->pr_mtx);
-
- /* Do not try to move the iface from and to the same prison. */
- if (pr->pr_vnet == ifp->if_vnet) {
- prison_free(pr);
+ /* Do not try to move the iface from and to the same vnet. */
+ if (pr->pr_vnet == TD_TO_VNET(td)) {
+ mtx_unlock(&pr->pr_mtx);
return (EEXIST);
}
+ prison_hold_locked(pr);
+ mtx_unlock(&pr->pr_mtx);
/* Make sure the named iface does not exists in the dst. prison/vnet. */
/* XXX Lock interfaces to avoid races. */
@@ -1250,7 +1249,6 @@
if_vmove_reclaim(struct thread *td, char *ifname, int jid)
{
struct prison *pr;
- struct vnet *vnet_dst;
struct ifnet *ifp;
int found __diagused;
bool shutdown;
@@ -1261,6 +1259,11 @@
sx_sunlock(&allprison_lock);
if (pr == NULL)
return (ENXIO);
+ /* Do not try to move the iface from and to the same vnet. */
+ if (pr->pr_vnet == TD_TO_VNET(td)) {
+ mtx_unlock(&pr->pr_mtx);
+ return (EEXIST);
+ }
prison_hold_locked(pr);
mtx_unlock(&pr->pr_mtx);
@@ -1273,14 +1276,6 @@
return (ENXIO);
}
- /* Do not try to move the iface from and to the same prison. */
- vnet_dst = TD_TO_VNET(td);
- if (vnet_dst == ifp->if_vnet) {
- CURVNET_RESTORE();
- prison_free(pr);
- return (EEXIST);
- }
-
/* Make sure the VNET is stable. */
shutdown = VNET_IS_SHUTTING_DOWN(ifp->if_vnet);
if (shutdown) {
@@ -1293,7 +1288,7 @@
found = if_unlink_ifnet(ifp, true);
MPASS(found);
sx_xlock(&ifnet_detach_sxlock);
- if_vmove(ifp, vnet_dst);
+ if_vmove(ifp, TD_TO_VNET(td));
sx_xunlock(&ifnet_detach_sxlock);
CURVNET_RESTORE();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 6, 3:19 PM (18 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41522604
Default Alt Text
D55832.1793978391.diff (1 KB)
Attached To
Mode
D55832: ifnet: if_vmove_(loan|reclaim): Refactor a bit the checking of src / dst vnet
Attached
Detach File
Event Timeline