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

From: Dominique Martinet

Date: Mon Jun 15 2026 - 09:16:11 EST


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 <zhaoyz24@xxxxxxxxxxxxxxxxxxxxx>
> Reported-by: Yuxiang Yang <yangyx22@xxxxxxxxxxxxxxxxxxxxx>
> Reported-by: Ao Wang <wangao@xxxxxxxxxx>
> Reported-by: Xuewei Feng <fengxw06@xxxxxxx>
> Reported-by: Qi Li <qli01@xxxxxxxxxxxxxxx>
> Reported-by: Ke Xu <xuke@xxxxxxxxxxxxxxx>
> Suggested-by: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>
> Assisted-by: GLM:GLM-5.1
> Signed-off-by: Yizhou Zhao <zhaoyz24@xxxxxxxxxxxxxxxxxxxxx>

Thanks, picked up
--
Dominique