mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 22:07:35 -04:00
ipv4: fib: Convert fib_net_exit_batch() to ->exit_rtnl().
Currently, IPv4 routes are flushed in ->exit_batch() after all devices are unregistered. Unlike IPv6, IPv4 routes are not added from the fast path, so we can flush routes before default_device_exit_batch(). Let's call ip_fib_net_exit() from ->exit_rtnl() to save one RTNL locking dance. ip_fib_net_exit() must use list_del_rcu() for fib_table for the fast path on dying dev. Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260612063225.455191-6-kuniyu@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
5a7fef12d9
commit
759923cf03
@@ -1607,7 +1607,7 @@ static void ip_fib_net_exit(struct net *net)
|
||||
struct fib_table *tb;
|
||||
|
||||
hlist_for_each_entry_safe(tb, tmp, head, tb_hlist) {
|
||||
hlist_del(&tb->tb_hlist);
|
||||
hlist_del_rcu(&tb->tb_hlist);
|
||||
fib_table_flush(net, tb, true);
|
||||
fib_free_table(tb);
|
||||
}
|
||||
@@ -1663,29 +1663,24 @@ static void __net_exit fib_net_pre_exit(struct net *net)
|
||||
nl_fib_lookup_exit(net);
|
||||
}
|
||||
|
||||
static void __net_exit fib_net_exit_batch(struct list_head *net_list)
|
||||
static void __net_exit fib_net_exit_rtnl(struct net *net,
|
||||
struct list_head *dev_kill_list)
|
||||
{
|
||||
struct net *net;
|
||||
ip_fib_net_exit(net);
|
||||
}
|
||||
|
||||
rtnl_lock();
|
||||
list_for_each_entry(net, net_list, exit_list) {
|
||||
__rtnl_net_lock(net);
|
||||
ip_fib_net_exit(net);
|
||||
__rtnl_net_unlock(net);
|
||||
}
|
||||
rtnl_unlock();
|
||||
|
||||
list_for_each_entry(net, net_list, exit_list) {
|
||||
kfree(net->ipv4.fib_table_hash);
|
||||
fib4_notifier_exit(net);
|
||||
fib4_semantics_exit(net);
|
||||
}
|
||||
static void __net_exit fib_net_exit(struct net *net)
|
||||
{
|
||||
kfree(net->ipv4.fib_table_hash);
|
||||
fib4_notifier_exit(net);
|
||||
fib4_semantics_exit(net);
|
||||
}
|
||||
|
||||
static struct pernet_operations fib_net_ops = {
|
||||
.init = fib_net_init,
|
||||
.pre_exit = fib_net_pre_exit,
|
||||
.exit_batch = fib_net_exit_batch,
|
||||
.exit_rtnl = fib_net_exit_rtnl,
|
||||
.exit = fib_net_exit,
|
||||
};
|
||||
|
||||
static const struct rtnl_msg_handler fib_rtnl_msg_handlers[] __initconst = {
|
||||
|
||||
Reference in New Issue
Block a user