netns: no longer hold RTNL in rtnl_net_dumpid()
Subsystems (2)
PATCH 1/1 netns: no longer hold RTNL in rtnl_net_dumpid()
- rtnl_net_dumpid() is already fully RCU protected, RTNL is not needed there.
- Fix return value at the end of a dump,
so that NLMSG_DONE can be appended to current skb, saving one recvmsg() system call.
--- net/core/net_namespace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/core/net_namespace.c +3 -2
@@ -1090,7 +1090,7 @@ static int rtnl_net_dumpid(struct sk_buff *skb, struct netlink_callback *cb) end:if (net_cb.fillargs.add_ref)put_net (net_cb.tgt_net); -return err <0 ? err : skb->len; +return err; } static void rtnl_net_notifyid(struct net *net, int cmd, int id, u32 portid,
@@ -1205,7 +1205,8 @@ void __init net_ns_init(void)rtnl_register (PF_UNSPEC ,RTM_NEWNSID , rtnl_net_newid,NULL ,RTNL_FLAG_DOIT_UNLOCKED );rtnl_register (PF_UNSPEC ,RTM_GETNSID , rtnl_net_getid, rtnl_net_dumpid, -RTNL_FLAG_DOIT_UNLOCKED ); +RTNL_FLAG_DOIT_UNLOCKED | +RTNL_FLAG_DUMP_UNLOCKED ); }static void free_exit_list (struct pernet_operations *ops,struct list_head *net_exit_list)
Signature · 1 line
2.44.0.683.g7961c838ac-goog
Quoted 6 lines · Eric Dumazet
-
rtnl_net_dumpid()is already fully RCU protected, RTNL is not needed there.- Fix return value at the end of a dump,
so thatNLMSG_DONEcan be appended to current skb, saving onerecvmsg()system call.
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Tue, 16 Apr 2024 14:07:39 +0000 you wrote:
-
rtnl_net_dumpid()is already fully RCU protected, RTNL is not needed there.- Fix return value at the end of a dump,
so thatNLMSG_DONEcan be appended to current skb, saving onerecvmsg()system call.[...]
Here is the summary with links:
- [net-next] netns: no longer hold RTNL in rtnl_net_dumpid()
https://git.kernel.org/netdev/net-next/c/1514b06aff16
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html