From: Dominique Martinet <asmadeus@codewreck.org>
To: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
Cc: v9fs@lists.linux.dev, Eric Van Hensbergen <ericvh@kernel.org>,
Latchesar Ionkov <lucho@ionkov.net>,
Christian Schoenebeck <linux_oss@crudebyte.com>,
linux-kernel@vger.kernel.org,
Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>,
Ao Wang <wangao@seu.edu.cn>, Xuewei Feng <fengxw06@126.com>,
Qi Li <qli01@tsinghua.edu.cn>, Ke Xu <xuke@tsinghua.edu.cn>
Subject: Re: [PATCH] 9p/rdma: create RDMA CM ID in caller's net namespace
Date: Fri, 29 May 2026 17:10:46 +0900 [thread overview]
Message-ID: <ahlKBgzjaWnu0pMr@codewreck.org> (raw)
In-Reply-To: <20260529070817.76798-1-zhaoyz24@mails.tsinghua.edu.cn>
Yizhou Zhao wrote on Fri, May 29, 2026 at 03:08:15PM +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 the caller's network namespace for the
> RDMA CM ID as well, so that RDMA transport setup follows the same
> namespace context as the process performing the mount.
>
> 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@mails.tsinghua.edu.cn>
> Reported-by: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>
> Reported-by: Ao Wang <wangao@seu.edu.cn>
> Reported-by: Xuewei Feng <fengxw06@126.com>
> Reported-by: Qi Li <qli01@tsinghua.edu.cn>
> Reported-by: Ke Xu <xuke@tsinghua.edu.cn>
> Assisted-by: GLM:GLM-5.1
> Signed-off-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
> ---
> net/9p/trans_rdma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
> index aa5bd74..ea49b15 100644
> --- a/net/9p/trans_rdma.c
> +++ b/net/9p/trans_rdma.c
> @@ -541,7 +541,7 @@ rdma_create_trans(struct p9_client *client, struct fs_context *fc)
> return -ENOMEM;
>
> /* Create the RDMA CM ID */
> - rdma->cm_id = rdma_create_id(&init_net, p9_cm_event_handler, client,
> + rdma->cm_id = rdma_create_id(current->nsproxy->net_ns, p9_cm_event_handler, client,
We apparently should use fc->net_ns[1] (likewise in other transports that
use current->nsproxy->net_ns)
[1] https://sashiko.dev/#/patchset/20260529070817.76798-1-zhaoyz24%40mails.tsinghua.edu.cn
If you have time please send a (separate) patch fixing trans_fd.c ?
--
Dominique Martinet | Asmadeus
next prev parent reply other threads:[~2026-05-29 8:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 7:08 [PATCH] 9p/rdma: create RDMA CM ID in caller's net namespace Yizhou Zhao
2026-05-29 8:10 ` Dominique Martinet [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-05-29 9:10 Yizhou Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ahlKBgzjaWnu0pMr@codewreck.org \
--to=asmadeus@codewreck.org \
--cc=ericvh@kernel.org \
--cc=fengxw06@126.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=qli01@tsinghua.edu.cn \
--cc=v9fs@lists.linux.dev \
--cc=wangao@seu.edu.cn \
--cc=xuke@tsinghua.edu.cn \
--cc=yangyx22@mails.tsinghua.edu.cn \
--cc=zhaoyz24@mails.tsinghua.edu.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox