diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2024-02-07 18:55:15 -0800 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2024-02-07 18:55:16 -0800 |
| commit | b6b614558ed5b2ca50edacc0f2fbf5f52158c86c (patch) | |
| tree | f7dcd82263393d8c8dee032a7f6926cd43f9a045 /net/ipv6/ip6_gre.c | |
| parent | Merge branch 'mt7530-dsa-subdriver-improvements-act-ii' (diff) | |
| parent | xfrm: interface: use exit_batch_rtnl() method (diff) | |
| download | linux-b6b614558ed5b2ca50edacc0f2fbf5f52158c86c.tar.gz linux-b6b614558ed5b2ca50edacc0f2fbf5f52158c86c.zip | |
Merge branch 'net-more-factorization-in-cleanup_net-paths'
Eric Dumazet says:
====================
net: more factorization in cleanup_net() paths
This series is inspired by recent syzbot reports hinting to RTNL and
workqueue abuses.
rtnl_lock() is unfair to (single threaded) cleanup_net(), because
many threads can cause contention on it.
This series adds a new (struct pernet_operations) method,
so that cleanup_net() can hold RTNL longer once it finally
acquires it.
It also factorizes unregister_netdevice_many(), to further
reduce stalls in cleanup_net().
Link: https://lore.kernel.org/netdev/CANn89iLJrrJs+6Vc==Un4rVKcpV0Eof4F_4w1_wQGxUCE2FWAg@mail.gmail.com/T/#u
https://lore.kernel.org/netdev/170688415193.5216.10499830272732622816@kwain/
====================
Link: https://lore.kernel.org/r/20240206144313.2050392-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ipv6/ip6_gre.c')
| -rw-r--r-- | net/ipv6/ip6_gre.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 070d87abf7c0..428f03e9da45 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -1632,21 +1632,19 @@ err_alloc_dev: return err; } -static void __net_exit ip6gre_exit_batch_net(struct list_head *net_list) +static void __net_exit ip6gre_exit_batch_rtnl(struct list_head *net_list, + struct list_head *dev_to_kill) { struct net *net; - LIST_HEAD(list); - rtnl_lock(); + ASSERT_RTNL(); list_for_each_entry(net, net_list, exit_list) - ip6gre_destroy_tunnels(net, &list); - unregister_netdevice_many(&list); - rtnl_unlock(); + ip6gre_destroy_tunnels(net, dev_to_kill); } static struct pernet_operations ip6gre_net_ops = { .init = ip6gre_init_net, - .exit_batch = ip6gre_exit_batch_net, + .exit_batch_rtnl = ip6gre_exit_batch_rtnl, .id = &ip6gre_net_id, .size = sizeof(struct ip6gre_net), }; |
