mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02: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:
parent
5a7fef12d9
commit
759923cf03
|
|
@ -1607,7 +1607,7 @@ static void ip_fib_net_exit(struct net *net)
|
||||||
struct fib_table *tb;
|
struct fib_table *tb;
|
||||||
|
|
||||||
hlist_for_each_entry_safe(tb, tmp, head, tb_hlist) {
|
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_table_flush(net, tb, true);
|
||||||
fib_free_table(tb);
|
fib_free_table(tb);
|
||||||
}
|
}
|
||||||
|
|
@ -1663,29 +1663,24 @@ static void __net_exit fib_net_pre_exit(struct net *net)
|
||||||
nl_fib_lookup_exit(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();
|
static void __net_exit fib_net_exit(struct net *net)
|
||||||
list_for_each_entry(net, net_list, exit_list) {
|
{
|
||||||
__rtnl_net_lock(net);
|
kfree(net->ipv4.fib_table_hash);
|
||||||
ip_fib_net_exit(net);
|
fib4_notifier_exit(net);
|
||||||
__rtnl_net_unlock(net);
|
fib4_semantics_exit(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 struct pernet_operations fib_net_ops = {
|
static struct pernet_operations fib_net_ops = {
|
||||||
.init = fib_net_init,
|
.init = fib_net_init,
|
||||||
.pre_exit = fib_net_pre_exit,
|
.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 = {
|
static const struct rtnl_msg_handler fib_rtnl_msg_handlers[] __initconst = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user