X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=net%2Fcore%2Fnet_namespace.c;h=1f15abb1d733c702d8dfaf62898db3712bdd90e5;hb=7866cc57b51c1e118e5d78d1a8f721f378eec5c4;hp=1934efd4a9d4986f3497abc40968fd08c91896b3;hpb=d484467c860dab3e17893d23b2238e1f581460fa;p=mirror_ubuntu-artful-kernel.git diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 1934efd4a9d4..1f15abb1d733 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -482,6 +482,23 @@ static void cleanup_net(struct work_struct *work) net_drop_ns(net); } } + +/** + * net_ns_barrier - wait until concurrent net_cleanup_work is done + * + * cleanup_net runs from work queue and will first remove namespaces + * from the global list, then run net exit functions. + * + * Call this in module exit path to make sure that all netns + * ->exit ops have been invoked before the function is removed. + */ +void net_ns_barrier(void) +{ + mutex_lock(&net_mutex); + mutex_unlock(&net_mutex); +} +EXPORT_SYMBOL(net_ns_barrier); + static DECLARE_WORK(net_cleanup_work, cleanup_net); void __put_net(struct net *net)