Page MenuHomeFreeBSD

D45690.1775644514.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D45690.1775644514.diff

diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1235,6 +1235,22 @@
#ifdef VIMAGE
finish_vnet_shutdown:
#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();
+ NET_EPOCH_DRAIN_CALLBACKS();
/*
* We cannot hold the lock over dom_ifdetach calls as they might
* sleep, for example trying to drain a callout, thus open up the

File Metadata

Mime Type
text/plain
Expires
Wed, Apr 8, 10:35 AM (13 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28300627
Default Alt Text
D45690.1775644514.diff (1 KB)

Event Timeline