mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:24:45 +01:00
pfcp: Convert pfcp_net_exit() to ->exit_rtnl().
pfcp_net_exit() holds RTNL and cleans up all devices in the netns
and other devices tied to sockets in the netns.
We can use ->exit_rtnl() to save RTNL dance for all dying netns.
Note that we delegate the for_each_netdev() part to
default_device_exit_batch() to avoid a list corruption splat
like the one reported in commit 4ccacf8649 ("gtp: Suppress
list corruption splat in gtp_net_exit_batch_rtnl().")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20250418003259.48017-3-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
434efd3d0c
commit
81eccc131b
1 changed files with 7 additions and 16 deletions
|
|
@ -245,30 +245,21 @@ static int __net_init pfcp_net_init(struct net *net)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void __net_exit pfcp_net_exit(struct net *net)
|
||||
static void __net_exit pfcp_net_exit_rtnl(struct net *net,
|
||||
struct list_head *dev_to_kill)
|
||||
{
|
||||
struct pfcp_net *pn = net_generic(net, pfcp_net_id);
|
||||
struct pfcp_dev *pfcp, *pfcp_next;
|
||||
struct net_device *dev;
|
||||
LIST_HEAD(list);
|
||||
|
||||
rtnl_lock();
|
||||
for_each_netdev(net, dev)
|
||||
if (dev->rtnl_link_ops == &pfcp_link_ops)
|
||||
pfcp_dellink(dev, &list);
|
||||
|
||||
list_for_each_entry_safe(pfcp, pfcp_next, &pn->pfcp_dev_list, list)
|
||||
pfcp_dellink(pfcp->dev, &list);
|
||||
|
||||
unregister_netdevice_many(&list);
|
||||
rtnl_unlock();
|
||||
pfcp_dellink(pfcp->dev, dev_to_kill);
|
||||
}
|
||||
|
||||
static struct pernet_operations pfcp_net_ops = {
|
||||
.init = pfcp_net_init,
|
||||
.exit = pfcp_net_exit,
|
||||
.id = &pfcp_net_id,
|
||||
.size = sizeof(struct pfcp_net),
|
||||
.init = pfcp_net_init,
|
||||
.exit_rtnl = pfcp_net_exit_rtnl,
|
||||
.id = &pfcp_net_id,
|
||||
.size = sizeof(struct pfcp_net),
|
||||
};
|
||||
|
||||
static int __init pfcp_init(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue