Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if.c
Show First 20 Lines • Show All 1,230 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
rt_flushifroutes(ifp); | rt_flushifroutes(ifp); | ||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
finish_vnet_shutdown: | finish_vnet_shutdown: | ||||
#endif | #endif | ||||
/* | /* | ||||
* Objects associated with this ifnet have been deregistered from | |||||
* tables/lists here, but other threads may still reference the | |||||
* objects (e.g. nhop_objects). We need to clear ifp->if_afdata[] | |||||
* after the refereces are finished because other threads may access | |||||
* the contents of ifp->if_afdata[] in such references | |||||
* (in6_selecthlim() for example). | |||||
* Those references are (and should be) guarded by the net_epoch | |||||
* so we can wait for the end of the reference with | |||||
* epoch_wait_preempt() and NET_EPOCH_DRAIN_CALLBACKS(). | |||||
* After these calls, objects assosiated with this ifnet are | |||||
* not kept referenced or will not be fetched because they are | |||||
* deregistered from tables/lists. | |||||
*/ | |||||
NET_EPOCH_WAIT(); | |||||
zlei: Use NET_EPOCH_WAIT() instead. | |||||
Done Inline ActionsThanks for looking at the problem in detail. takahiro.kurosawa_gmail.com: Thanks for looking at the problem in detail.
Updated according to the comment though further… | |||||
NET_EPOCH_DRAIN_CALLBACKS(); | |||||
/* | |||||
* We cannot hold the lock over dom_ifdetach calls as they might | * We cannot hold the lock over dom_ifdetach calls as they might | ||||
* sleep, for example trying to drain a callout, thus open up the | * sleep, for example trying to drain a callout, thus open up the | ||||
* theoretical race with re-attaching. | * theoretical race with re-attaching. | ||||
*/ | */ | ||||
IF_AFDATA_LOCK(ifp); | IF_AFDATA_LOCK(ifp); | ||||
i = ifp->if_afdata_initialized; | i = ifp->if_afdata_initialized; | ||||
ifp->if_afdata_initialized = 0; | ifp->if_afdata_initialized = 0; | ||||
IF_AFDATA_UNLOCK(ifp); | IF_AFDATA_UNLOCK(ifp); | ||||
▲ Show 20 Lines • Show All 4,002 Lines • Show Last 20 Lines |
Use NET_EPOCH_WAIT() instead.