PERFORCE change 149551 for review
Marko Zec
zec at FreeBSD.org
Wed Sep 10 17:49:51 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=149551
Change 149551 by zec at zec_tpx32 on 2008/09/10 17:48:54
Hold IFNET_WLOCK() when reassigning an ifnet from one vnet
to another.
Affected files ...
.. //depot/projects/vimage/src/sys/kern/kern_vimage.c#67 edit
Differences ...
==== //depot/projects/vimage/src/sys/kern/kern_vimage.c#67 (text+ko) ====
@@ -298,10 +298,11 @@
do {
INIT_VNET_NET(curvnet);
+ IFNET_WLOCK();
ifnet_setbyindex(ifp->if_index, NULL);
- /* XXX: should be locked with if_findindex() */
while (V_if_index > 0 && ifnet_byindex(V_if_index) == NULL)
V_if_index--;
+ IFNET_WUNLOCK();
} while (0);
CURVNET_SET_QUIET(new_vnet);
@@ -309,9 +310,8 @@
/*
* Try to find an empty slot below if_index. If we fail, take
* the next slot.
- *
- * XXX: should be locked!
*/
+ IFNET_WLOCK();
for (ifp->if_index = 1; ifp->if_index <= V_if_index; ifp->if_index++) {
if (ifnet_byindex(ifp->if_index) == NULL)
break;
@@ -325,6 +325,7 @@
if (V_if_index >= V_if_indexlim)
if_grow();
ifnet_setbyindex(ifp->if_index, ifp);
+ IFNET_WUNLOCK();
/* Rename the ifnet */
if (new_vnet == ifp->if_home_vnet) {
More information about the p4-projects
mailing list