diff --git a/sys/net/vnet.c b/sys/net/vnet.c --- a/sys/net/vnet.c +++ b/sys/net/vnet.c @@ -536,11 +536,13 @@ * Invoke the constructor on all the existing vnets when it is * registered. */ + VNET_LIST_RLOCK(); VNET_FOREACH(vnet) { CURVNET_SET_QUIET(vnet); vs->func(vs->arg); CURVNET_RESTORE(); } + VNET_LIST_RUNLOCK(); VNET_SYSINIT_WUNLOCK(); } @@ -591,6 +593,7 @@ * Invoke the destructor on all the existing vnets when it is * deregistered. */ + VNET_LIST_RLOCK(); VNET_SYSINIT_WLOCK(); VNET_FOREACH(vnet) { CURVNET_SET_QUIET(vnet); @@ -601,6 +604,7 @@ /* Remove the destructor from the global list of vnet destructors. */ TAILQ_REMOVE(&vnet_destructors, vs, link); VNET_SYSINIT_WUNLOCK(); + VNET_LIST_RUNLOCK(); } /*