Article View: linux.kernel.netdev
Article #26129Re: [PATCH net v6 2/2] net/rds: defer the probe cm_id destroy to rds_wq
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 03:38
Date: Thu, 03 Dec 2026 03:38
165 lines
13523 bytes
13523 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The commit message says that above RDS_IB_MAX_PROBE_PENDING
the check 'fails with -ENOMEM rather than returning a value that would…
- [Low] The new comment above struct rds_ib_probe_work in net/rds/ib.c
says the probe runs 'while rds_trans_get_preferred() holds…
--
net/rds: defer the probe cm_id destroy to rds_wq
This patch moves the rdma_destroy_id() of the probe cm_id in
rds_ib_laddr_check_cm() onto rds_wq. This avoids a recursive handler_mutex
lockdep report on the passive connection path. A global counter caps pending
destroys at RDS_IB_MAX_PROBE_PENDING (64), and rds_ib_exit() flushes rds_wq
before the module goes away.
> diff --git a/net/rds/ib.c b/net/rds/ib.c
> index 4ea9838d090c3..624374ecf4fad 100644
> --- a/net/rds/ib.c
> +++ b/net/rds/ib.c
> @@ -391,6 +391,31 @@ static void rds6_ib_ic_info(struct socket *sock, unsigned int len,
> }
> #endif
>
> +/*
> + * The probe cm_id must not be destroyed from the caller's context:
> + * rds_ib_laddr_check() runs it while rdma_cm's handler_mutex is held
> + * (the passive connection path) or while rds_trans_get_preferred() holds
> + * rds_trans_sem, and rdma_destroy_id() takes handler_mutex again. Queue
> + * the destruction on rds_wq, which runs without either lock.
> + */
[Severity: Low]
Is the rds_trans_sem part of this comment accurate? In this tree,
rds_trans_get_preferred() drops the semaphore before it calls
->laddr_check():
net/rds/transport.c:rds_trans_get_preferred() {
...
/*
* ->laddr_check() may create and destroy an rdma_cm id, which
* takes rdma_cm's handler_mutex. Don't hold rds_trans_sem
* across it: the module reference keeps trans alive.
*/
up_read(&rds_trans_sem);
if (trans->laddr_check(net, addr, scope_id) == 0)
return trans;
...
}
The SO_RDS_TRANSPORT path in rds_bind() doesn't take rds_trans_sem either.
The transport.c comment has the opposite problem. It says ->laddr_check()
destroys the rdma_cm id and takes handler_mutex, but with this patch the
destroy runs later on rds_wq.
Could both comments be updated so they describe the same locking rules for
->laddr_check()?
> +struct rds_ib_probe_work {
> + struct work_struct work;
> + struct rdma_cm_id *cm_id;
> +};
> +
> +static atomic_t rds_ib_probe_pending = ATOMIC_INIT(0);
> +#define RDS_IB_MAX_PROBE_PENDING 64
> +
> +static void rds_ib_probe_work_fn(struct work_struct *work)
> +{
> + struct rds_ib_probe_work *pw =
> + container_of(work, struct rds_ib_probe_work, work);
> +
> + rdma_destroy_id(pw->cm_id);
> + kfree(pw);
> + atomic_dec(&rds_ib_probe_pending);
> +}
[ ... ]
> @@ -414,11 +440,25 @@ static int rds_ib_laddr_check_cm(struct net *net, const struct in6_addr *addr,
> bool isv4;
>
> isv4 = ipv6_addr_v4mapped(addr);
> +
> + pw = kzalloc_obj(*pw);
> + if (!pw)
> + return -ENOMEM;
> +
> + if (atomic_inc_return(&rds_ib_probe_pending) > RDS_IB_MAX_PROBE_PENDING) {
> + atomic_dec(&rds_ib_probe_pending);
> + kfree(pw);
> + return -ENOMEM;
> + }
[Severity: Medium]
The commit message says:
above the bound the check fails with -ENOMEM rather than returning a
value that would make rds_trans_get_preferred() fall back to another
transport.
Does -ENOMEM actually prevent the fallback? rds_trans_get_preferred() only
checks for zero:
if (trans->laddr_check(net, addr, scope_id) == 0)
return trans;
rds_trans_put(trans);
down_read(&rds_trans_sem);
Any non-zero return, including -ENOMEM, moves on to the next registered
transport. RDS_TRANS_TCP comes after RDS_TRANS_IB, and
rds_tcp_laddr_check() returns 0 for any local address, IPoIB addresses
included.
rds_ib_probe_pending is also a single global counter that every caller
shares. Every call that reaches the cm path takes a slot. That covers every
IPv6 address and every IPv4 address that rds_ib_get_device() doesn't find,
including addresses that don't exist.
A slot is freed only when rds_ib_probe_work_fn() runs. rds_wq comes from
create_singlethread_workqueue("krdsd"), so those destroys wait behind all
other RDS work queued there. Nothing in net/rds/ requires a capability to
create AF_RDS sockets.
While more than 64 destroys are pending, an unrelated bind() seems to end up
like this:
- Without SO_RDS_TRANSPORT, an IB address is silently bound to RDS/TCP,
and rs->rs_transport keeps that value for the life of the socket. If
rds_tcp isn't loaded, the bind fails with -EADDRNOTAVAIL.
- With SO_RDS_TRANSPORT set to IB, rds_bind() returns -ENOPROTOOPT.
In both cases userspace never sees the -ENOMEM.
The loopback check in __rds_conn_create() also goes through this path:
loop_trans = rds_trans_get_preferred(net, faddr, conn->c_dev_if);
Could that check give the wrong answer during the same window?
I wasn't able to confirm how easily more than 64 destroys can be kept
pending in practice. Still, before this patch the destroy was synchronous
and there was no shared budget.
Is it intended that one user can use up this cap and affect everyone else?
Should the commit message's explanation for returning -ENOMEM be corrected?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202024054.1945-1-chenaibing%40cmss.chinamobile.com
Technical Details
Message-ID:
<179626908944.3146.15583990385934454167@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376264-linux-kernel-netdev=dewy.ruReferences:
<20261202024054.1945-3-chenaibing@cmss.chinamobile.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376264-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v6 2/2] net/rds: defer the probe cm_id destroy to rds_wq Date: Thu, 03 Dec 2026 03:38:09 +0000 Organization: Usenet Network Message-ID: <179626908944.3146.15583990385934454167@kernel.org> References: <20261202024054.1945-3-chenaibing@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2133415"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:m7r/2AGrW7aoGATMkoLGshzaVMI= sha256:phZQpwrlJ8IP3y6QKv0OW/Xq9Rd9cBv3q9btDHN8XUI= sha1:v8TQbhsCSm/2ogzvu8CJsRHQFr4= sha256:xkVodMI1AE9mulD2r0CNJUM1oCyt59gInFUNN5DytpA= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 2C9C811780A; Thu, 3 Dec 2026 06:38:40 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7TeYojHgOzn6; Thu, 3 Dec 2026 06:38:36 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376264-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 84A0D117807; Thu, 3 Dec 2026 06:38:27 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id BD10E29489; Thu, 3 Dec 2026 03:38:16 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796269096; b=klBrfy9eQeRuHimaybZUIVG7YqmAMBXXysx5XL2ma5OR/9md9aoHB/MZi0XD+ew5sBct VxBhnRLkjDw1A37U9bew5wwCiM6KbRmyrl7p7Tvf+If6C6nhbVrpw4k9ENxMGxaVuCVWJ m9XorO9RDjT9uQoBoJab82Dg4MVfZx46GNMyzx+gtkvFR7cWahnvlf7BKkvIMhgdDzYvV UmL0AI9RpNHG/QelcxMI3JbDkV41ikiL/irLAm94qTRz2x/CuBEgI56WxJJFnHtcWz7yj WcwBO973ieE9c7qSY4JZIzKRqDkB8lKTPYdBWw/BLKYXOfJW4GHPI0nlPxp9i1HP+ug== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796269096; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=aMNCeY8+pNMwbxshp6tu+xxMPQxrHvZo6Nzlc7r/u+Y=; b=egfNAL/N9eQJgrptZ5ev+1H8wWPWrtgNXBLeRH4MFxW52ru+ba5pycFEJghmdb06FIrk zVNY/jvImBz7FQG0APOVRAdyDL5ZReT0Re+0ukmfO1Bm4CX8quCLSoAAFPma3cjgEWPiD NLnX8NRyFN/hKuH/ODyMjUmKyyjEK+ysh+N9b1MiClAyyDGVSsvECRQ53WVYsqblT461T ocIRCZcveGNY8uLegDVwSuayZBeRPhInfPjbmEdrah1QnjCbwHGNTzNizKv0dQVfy/diK VCZl3dWgqhH8MHEtboH2bP3gWFpc7MwR76yDhiQGMU49w+6Pcy/Ah5ZQk87U/cM+hfg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BIgPwh6u; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90B21606A682; Thu, 3 Dec 2026 03:38:16 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BIgPwh6u X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796269090; b=fg0BNdBnvbPy6ceb5lJErzfWjy7UuhG3sJkmp4/6Z7rDlPuUpMCvYWVmRng0KCXjFZl6 KZludt/fxDL6eaa5ZOiM38VlgWnTlrchWMT+5adNDn/B8QdFpyHi9btqKansqA83fIlsW gxJ6cV47Doi9Rtf2e5yzahwW3Q1WoXgj5Z0iIQNRfPapei6sv9yYtkRYVUzMpyE0AS+7d 0q57ej+tLKQqqr1IpibaIvbMiMvGeCCemXaEuLAZLmAOafCzbq465tjggjClCU6IsAbAq ZIksb9AeDMQYmCp5VrzfdfozUkFWouTpdY2npz6Zjnb9Z5DHBRwFodk3PLq0xYMlSnQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796269090; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=aMNCeY8+pNMwbxshp6tu+xxMPQxrHvZo6Nzlc7r/u+Y=; b=SRZqEyj1LyzeHXPSP1XU4ZPNl6E7IpOKizRritqY64Q2qdsuAtm4vOUI10Mqt62GVuok FJoFDBAaxZJ4tFnUSO0xQlFHQuu6PaJJUTIEGPQ0pfIspGYCL2Mm+JzmIgzQMLl+SgEpZ qcA/LmYTxMHNkdACn4hXy9G64L//HlM+1s0T/ek+7mMEcy59Qq1AYt9qP2whrgSWzkTYk jxcbk7PO95Hv8Bh0kegYL9b4qJdjWJkD7GvYLplXIuQKXvWKdh08XPB5I19ZUfY0zs/+8 7SLGcPqgiEmdfHuNBUXmnd5ShsTy68yRjiFgq6CZhrsunWMrXEW3uSW9Z+FKBmB3dfQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BIgPwh6u; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A73C9606A68C; Thu, 3 Dec 2026 03:38:10 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D98A51F00898; Thu, 3 Dec 2026 03:38:09 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796269090; bh=aMNCeY8+pNMwbxshp6tu+xxMPQxrHvZo6Nzlc7r/u+Y=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=BIgPwh6utiFgV8N5NkU1Ts+3WhedS58n6a/5vBxb9S92x+O1jvnWu9gvPHNGWQPYo j8sYhZyFAOPDEwySbaed0aQ0AzFJxReVtYxlmr5sMBTOHPzEfO20KpHqDWm6tNaIE2 E+XZFA0ckplKyjVIHYu91H/y86PNaKmFuvZXsJnvovNAy+vahpM2SrwOnMVXlddfm+ yQ0RSYLhq81bw4KsVeuoXI796+lTLUJc8VNFIKb39eagHwRRDod0h22BOTvtpgwyO9 w9L+ZBkrECc110dQGHcGKtiM6pBBGAfkMk/L61s5nx0NlwWp+HidZLRp+XQd4NjpVf EIvjj93DV8MCw== X-Cc: achender@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kuba@kernel.org X-In-Reply-To: <20261202024054.1945-3-chenaibing@cmss.chinamobile.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list