[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250526053227.GD11639@lst.de>
Date: Mon, 26 May 2025 07:32:27 +0200
From: Christoph Hellwig <hch@....de>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Willem de Bruijn <willemb@...gle.com>,
Simon Horman <horms@...nel.org>,
Kuniyuki Iwashima <kuni1840@...il.com>,
Chuck Lever <chuck.lever@...cle.com>,
Jeff Layton <jlayton@...nel.org>,
Matthieu Baerts <matttbe@...nel.org>,
Keith Busch <kbusch@...nel.org>, Jens Axboe <axboe@...nel.dk>,
Christoph Hellwig <hch@....de>, Wenjia Zhang <wenjia@...ux.ibm.com>,
Jan Karcher <jaka@...ux.ibm.com>, Steve French <sfrench@...ba.org>,
netdev@...r.kernel.org, mptcp@...ts.linux.dev,
linux-nfs@...r.kernel.org, linux-rdma@...r.kernel.org,
linux-nvme@...ts.infradead.org
Subject: Re: [PATCH v2 net-next 3/7] socket: Restore sock_create_kern().
On Fri, May 23, 2025 at 11:21:09AM -0700, Kuniyuki Iwashima wrote:
> Let's restore sock_create_kern() that holds a netns reference.
>
> Now, it's the same as the version before commit 26abe14379f8 ("net:
> Modify sk_alloc to not reference count the netns of kernel sockets.").
>
> Back then, after creating a socket in init_net, we used sk_change_net()
> to drop the netns ref and switch to another netns, but now we can
> simply use __sock_create_kern() instead.
>
> $ git blame -L:sk_change_net include/net/sock.h 26abe14379f8~
>
> DEBUG_NET_WARN_ON_ONCE() is to catch a path calling sock_create_kern()
> from __net_init functions, since doing so would leak the netns as
> __net_exit functions cannot run until the socket is removed.
Is reusing the name as the old sock_create_kern a good idea? It can
lead to bugs by people used to the old semantics. It's also
not really an all that descriptive name for either variant. I'm
not really a net stack or namespace expert, but maybe we can come
up with more descriptive version for both this new sock_create_kern
and the old sock_create_kern/__sock_create_kern?
Powered by blists - more mailing lists