Re: [PATCH v2] 9p: use fc->net_ns for network namespace in RDMA and socket transports

Dominique Martinet <[email protected]> Mon, 15 Jun 2026 22:15:41 +0900
Newsgroups dev.linux.lists.v9fs,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Yizhou Zhao wrote on Fri, May 29, 2026 at 05:06:24PM +0800:
> The 9p RDMA transport currently passes &init_net to rdma_create_id().
> As a result, RDMA address resolution and connection setup are performed
> in the initial network namespace, even when the mount is initiated from
> a non-initial network namespace.
> 
> This differs from the socket-based 9p transports, which create sockets
> in current->nsproxy->net_ns.  Use fc->net_ns for both the RDMA and
> socket transports instead, so that transport setup follows the VFS
> mount namespace context rather than depending on the calling process's
> current namespace.
> 
> This avoids surprising behaviour where a 9p RDMA mount from a container
> or other non-initial network namespace may use the host namespace for
> RDMA CM operations.
> 
> Fixes: fa20105e09e9 ("IB/cma: Add support for network namespaces")
> Reported-by: Yizhou Zhao <[email protected]>
> Reported-by: Yuxiang Yang <[email protected]>
> Reported-by: Ao Wang <[email protected]>
> Reported-by: Xuewei Feng <[email protected]>
> Reported-by: Qi Li <[email protected]>
> Reported-by: Ke Xu <[email protected]>
> Suggested-by: Dominique Martinet <[email protected]>
> Assisted-by: GLM:GLM-5.1
> Signed-off-by: Yizhou Zhao <[email protected]>

Thanks, picked up
-- 
Dominique