Article View: linux.kernel.netdev
Article #7285Re: [PATCH] net/rds: hold IB device reference through deferred cleanup
From: Allison Henderson
Date: Mon, 26 Oct 2026 00:37
Date: Mon, 26 Oct 2026 00:37
118 lines
12075 bytes
12075 bytes
On Fri, 2026-10-23 at 12:02 +0200, Eduard Zateev wrote:
> RDS device teardown queues rds_ib_dev_free() on rds_wq. Hold a
> reference to the underlying IB device until deferred cleanup releases
> its resources. This prevents device removal from freeing it while the
> work is running.
Hi Eduard,
Thanks for the patch. Some comments below:
>
> Reported-by: syzbot+221e213bf17f17e0d6cd@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=221e213bf17f17e0d6cd
The report referenced here doesnt actually point to RDS, it's a warning in rxe_pool_cleanup.
Do you have a trace or a syz test result showing that the leftover rxe object is the RDS PD
or MR and that this patch resolves the warning? Otherwise, I think the closes tag should be
removed.
> Signed-off-by: Eduard Zateev <hackerowskiy@gmail.com>
> ---
> net/rds/ib.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/net/rds/ib.c b/net/rds/ib.c
> index 786f39169bc..597872e4fe9 100644
> --- a/net/rds/ib.c
> +++ b/net/rds/ib.c
> @@ -115,6 +115,7 @@ static void rds_ib_dev_free(struct work_struct *work)
>
> kfree(rds_ibdev->vector_load);
>
> + ib_device_put(rds_ibdev->dev);
> kfree(rds_ibdev);
> }
>
> @@ -142,6 +143,12 @@ static int rds_ib_add_one(struct ib_device *device)
> ibdev_to_node(device));
> if (!rds_ibdev)
> return -ENOMEM;
> + /* Keep the device registered until the deferred cleanup completes. */
> + if (!ib_device_try_get(device)) {
The commit message doesn't quite describe what this does. Holding the reference doesn't stop
the device from being freed while the work runs. It makes ib_unregister_device() block in
disable_device() until the refcount reaches zero, which now only happens when rds_ib_dev_free()
calls ib_device_put(). For connections that wait is short, since rdma_cm tears them down during
the same removal, but connections are not the only things that hold the rds_ib_device.
A registered MR keeps the reference it takes in rds_ib_get_mr() until rds_ib_free_mr() drops
it. That only happens once everything using the MR has let go. Including the socket (when it
frees the MR or closes), and every queued message that uses it (when the peer acks it or the
socket closes). Those messages also survive connection drops (rds_send_path_reset() requeues
them), and with the device gone the connection can't come back up over it to get them acked.
So with this patch, whoever is unregistering the device (rdma link delete, driver unload, PCI
hot-unplug) blocks in disable_device() until the process that owns the socket lets go, which
it may never do. It also turns any leaked rds_ib_device reference into a permanent unregister
hang. I have a fix for one such leak, a connection left attached at module unload, in the
connection-lifetime series I've been iterating on, but it hasn't landed yet.
Unfortunately this is not a simple fix, even after kref lands. To wait for the free safely,
remove_one first needs a way to make the device's MRs be released, so that the wait is
guaranteed to finish. The uek tree approach is a socket accounting feature:
https://github.com/oracle/linux-uek/commit/ba92066dbf13e573a292252ea07e686b5104f091
https://github.com/oracle/linux-uek/commit/dc4c8c665368bca276db02ba7071d2d3fd653a10
https://github.com/oracle/linux-uek/commit/fcd394a1095625a39c44aa709bd976c6b9b98373
You're certainly welcome to look at it, but it is a bigger rework of the removal path than
this patch, and I'd rather not take a partial fix that turns the warning into a hang.
Thank you for looking at this though!
Allison
> + kfree(rds_ibdev);
> + return -ENODEV;
> + }
> + rds_ibdev->dev = device;
>
> spin_lock_init(&rds_ibdev->spinlock);
> refcount_set(&rds_ibdev->refcount, 1);
> @@ -180,7 +187,6 @@ static int rds_ib_add_one(struct ib_device *device)
> goto put_dev;
> }
>
> - rds_ibdev->dev = device;
> rds_ibdev->pd = ib_alloc_pd(device, 0);
> if (IS_ERR(rds_ibdev->pd)) {
> ret = PTR_ERR(rds_ibdev->pd);
Technical Details
Message-ID:
<dc5e58c172ad4b4bab4b8e0a385c608245618a65.camel@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351650-linux-kernel-netdev=dewy.ruReferences:
<20261023100206.126692-1-hackerowskiy@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351650-linux-kernel-netdev=dewy.ru From: achender@kernel.org (Allison Henderson) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] net/rds: hold IB device reference through deferred cleanup Date: Sun, 25 Oct 2026 17:37:53 -0700 Organization: Usenet Network Message-ID: <dc5e58c172ad4b4bab4b8e0a385c608245618a65.camel@kernel.org> References: <20261023100206.126692-1-hackerowskiy@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="1182531"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Hi8paNYDSJzGeIyUNoHgPeZxpYY= sha256:eTMLNHLjS1+casdtfrf6g7FsD4d4qWZa6V8X0h63shg= sha1:0/QTWms/RpOU5B9URMecDShy5aU= sha256:a2fkLlBFF8IkPOOcRuVzv3f/KSK+8DS5L9bZTzE+aX4= 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 1C85A125B88; Mon, 26 Oct 2026 03:39:39 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.738 X-Spam-Status: No, score=-3.738 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, 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, URIBL_BLOCKED=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 nkEZnIrC8nDP; Mon, 26 Oct 2026 03:39:35 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-351650-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 511B2125B87; Mon, 26 Oct 2026 03:39: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 8224C37C21; Mon, 26 Oct 2026 00:38:06 +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=1792975086; b=CjakxFdlTuYJHm35U3Ge5AN0oe1qdeuwvthojcKrA+QdgYJTIbmL38zmbsRa2LtkvrKK CnCsTsZKCuTAsWTcJxeelZmXMx3sxc9n+BShz/5AW8hlU2R3N2dAhck03J7XZ0P9omC+k U3mUij5c7V0oYbwkO8Raqr8srbijs3ARJRoqdkfqsXf1RS5yqs36QQA3gL0wRmCzKly2I E2x393nMm9neAN9VlSVt/hFzA/ie0KlbPByFmUIp3CQcmABgy42rNquaIv9/ZoplYv1Q2 ILCx/ZrYFwtVlbUFWewqKDUjWRJQRtrEsuiF0A98EeGfrfFet8auMJw9+1NIy97D5nQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792975086; h=X-Original-To:Received:Received:DKIM-Signature:Message-ID:Subject: From:To:Cc:Date:In-Reply-To:References:Content-Type: Content-Transfer-Encoding:User-Agent:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version; bh=3OpWhHDiC0q0IeZapx7WAsAnnypbwyXltg3+JfcCVTY=; b=zOgTu00PpbbS6Vuw7El9hYOMYZAQEuL1iNSH+g3EQEX+g1HCXH3AK22TjbtiTM1e4P9w M9iD8dbc0ITp1JHgqSumZgrO32bWzHy0eBAhbpEydA2SHV99mT52J2/4mez00mJT5/hQO du/xyq4sOj6IrLY6E3ho6jdwmbryhUG/nKrKSfQsaVUVYz+xi/1QA0oada+P8MVjydJj2 jZGwTSSh9DiteBx1aVcj7sq03kMe3jb5mQiXvYGYFQ/h4Jz89tahQ41IqxwmkzAxSvLdV zB34yp7SpxryP1eD7iECnrPeEA5MC9v3w4HkXyW4+p68hkFg9QJrNEO1ByaRmuIODcw== 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=mniVaYXS; 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 59B5C606A324; Mon, 26 Oct 2026 00:38:06 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=mniVaYXS 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=1792975075; b=b/3IVKLoMUcy2G3QLOue+d0gIsDUCtI3rPzaXDte7Zoi/YPtIc3Dd+iO1IvrfAgwnVQN 8uFreIHMe78yRBhm3b++TSTnbF4pjh5451BmPFEj2hhKt0foeijpj8gEm9wQ8hLBD4ETj liC2jyJLWjO5TMrCWcjtfTmxOj1Uiju27izniiSxPab3VmK2SdGyOBdpqeu39Tscn94of zapNKlJwHVkb5J9ebRNY41Am7/UHYf1aaLyb0bd5TyVzEgjn0uBwMY+xKovOHth4Wpz2K eZhsC9SFkVPzQXIvXHnOvsadOi+v09PulAZLzkch9ZeE7cVr1vGcNGycyrxLDuXrDtQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792975075; h=Received:DKIM-Signature:Message-ID:Subject:From:To:Cc:Date: In-Reply-To:References:Content-Type:Content-Transfer-Encoding: User-Agent:MIME-Version; bh=3OpWhHDiC0q0IeZapx7WAsAnnypbwyXltg3+JfcCVTY=; b=qyEak75youwFw1vCx4YKhU1AICtfR8wIKV/S/uMGNv+wRkm144xwAIARv19BsVQmROOI tmutKqQqdUsqxTEhtJpZp2PU4JIgzsLIlgVMOzzcIs9cgEwskgLfII1cEUEj1rVYs0Cpa nXZn1xpjczTm0k1rSjlQ2K0OzHyIn+mcZ4MjpGoAqZoxeH0QpgwDKDWv9JFF88rfw5Wj/ srnNi8gAs7LXCLpS17iG1Z7fHdIFEF3U24UramC1wpruXzm1Eq6oGReB1w5xlH/t8D/6h x0LLUJQuiR7HbQm3zhn7RyBlQflUEcVg3llMzeIq8KPc1uWG+aZZrBxLfc6Hgeu6B8g== 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=mniVaYXS; 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 365BF606A31A; Mon, 26 Oct 2026 00:37:54 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41A1E1F01825; Mon, 26 Oct 2026 00:37:54 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792975074; bh=3OpWhHDiC0q0IeZapx7WAsAnnypbwyXltg3+JfcCVTY=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=mniVaYXSw+J4T6DIlCx0v+dCBHkQHE+jD8iQly4/+6u8gr05I/QdIA65+slb44n6O 9WZ6CpkQOI+m5tX82JuJiWn+M4LhreXySfmykgGN3xgIsZow5JZWw7IhpiAcxioTpP 3Ux/uuztLXPUrcz96IghTPYv86/O8MXXtuEUL1zHyaouaqGMWbicGydS9NzhsGyLb5 I5TAkyc2pN4kVXYWXkPIXm0LuxtiUL1TNzHNuq5gEuxL2sdAAK9CDSmLfPUsoUZVrI 4fwdVjMQ6earOBEL2T0vD6DYyPoB5E+INh71qMUz9DCu4TOtzt7iWHAQe0z/8HsNxP XtGh0M3kfE4Zg== X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org, syzbot+221e213bf17f17e0d6cd@syzkaller.appspotmail.com X-In-Reply-To: <20261023100206.126692-1-hackerowskiy@gmail.com> X-User-Agent: Evolution 3.52.3-0ubuntu1.1 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