]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r368020, r368025:
authorKristof Provost <kp@FreeBSD.org>
Fri, 11 Dec 2020 15:39:22 +0000 (15:39 +0000)
committerKristof Provost <kp@FreeBSD.org>
Fri, 11 Dec 2020 15:39:22 +0000 (15:39 +0000)
commit06727beb9309f53402b232ffbd59e4c0ff6eb35f
treec62fe3242cfb3691d8f35cab64fc83a935f98544
parent42df5a4995fc34402e0e11924948f6714876b597
MFC r368020, r368025:

if: Protect V_ifnet in vnet_if_return()

When we terminate a vnet (i.e. jail) we move interfaces back to their home
vnet. We need to protect our access to the V_ifnet CK_LIST.

We could enter NET_EPOCH, but if_detach_internal() (called from if_vmove())
waits for net epoch callback completion. That's not possible from NET_EPOCH.
Instead, we take the IFNET_WLOCK, build a list of the interfaces that need to
move and, once we've released the lock, move them back to their home vnet.

We cannot hold the IFNET_WLOCK() during if_vmove(), because that results in a
LOR between ifnet_sx, in_multi_sx and iflib ctx lock.

Separate out moving the ifp into or out of V_ifnet, so we can hold the lock as
we do the list manipulation, but do not hold it as we if_vmove().

if: Fix non-VIMAGE build

if_link_ifnet() and if_unlink_ifnet() are needed even when VIMAGE is not
enabled.

Sponsored by: Modirum MDPay
sys/net/if.c