Article View: linux.kernel.netdev
Article #11449Re: [PATCH] net/rds: drop the device reference for ODP memory regions
From: Allison Henderson
Date: Wed, 04 Nov 2026 22:15
Date: Wed, 04 Nov 2026 22:15
65 lines
9880 bytes
9880 bytes
On Wed, 2026-11-04 at 02:28 +0000, Wentao Liang wrote:
> rds_ib_get_mr() takes a reference on the rds_ib_device with
> rds_ib_get_device(). The FRMR path stores it in ibmr->device and
> rds_ib_free_mr() drops it when the MR is freed.
>
> The ODP path allocates the ibmr with kzalloc_obj() and returns it
> without recording the device. rds_ib_odp_mr_worker() only deregisters
> the MR and frees the ibmr, so the reference taken for every ODP MR is
> never dropped and the rds_ib_device can no longer be released.
>
> Store the reference in ibmr->device and drop it in the worker after
> the MR has been deregistered, which also keeps the device and its PD
> alive for as long as the MR exists.
>
> Fixes: 2eafa1746f17 ("net/rds: Handle ODP mr registration/unregistration")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Hi Wentao,
Thanks for the patch. The fix itself looks reasonable, but few things to update: since
this is a bug fix, it should should target net with [PATCH net v2]. The commit message
should mention how this was found, and whether it was tested. Reproducing this needs an
ODP-capable device, so if it was only build-tested, please say so. It looks like there's
a few check patch nits to work through as well:
https://patchwork.kernel.org/project/netdevbpf/patch/20261104022810.1484182-1-vulab@iscas.ac.cn/
Other than that it looks straight forward to me.
Thanks,
Allison
> ---
> net/rds/ib_rdma.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
> index db7e92e7bd29..8cd8295f66a3 100644
> --- a/net/rds/ib_rdma.c
> +++ b/net/rds/ib_rdma.c
> @@ -591,6 +591,7 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents,
> }
> ibmr->u.mr = ib_mr;
> ibmr->odp = 1;
> + ibmr->device = rds_ibdev;
>
> sge.addr = virt_addr;
> sge.length = length;
> @@ -697,5 +698,6 @@ static void rds_ib_odp_mr_worker(struct work_struct *work)
>
> ibmr = container_of(work, struct rds_ib_mr, work.work);
> ib_dereg_mr(ibmr->u.mr);
> + rds_ib_dev_put(ibmr->device);
> kfree(ibmr);
> }
Technical Details
Message-ID:
<b9b97bf371302d42319ce21fbd4532d39ee97a28.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-356978-linux-kernel-netdev=dewy.ruReferences:
<20261104022810.1484182-1-vulab@iscas.ac.cn>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-356978-linux-kernel-netdev=dewy.ru From: achender@kernel.org (Allison Henderson) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] net/rds: drop the device reference for ODP memory regions Date: Wed, 04 Nov 2026 15:15:46 -0700 Organization: Usenet Network Message-ID: <b9b97bf371302d42319ce21fbd4532d39ee97a28.camel@kernel.org> References: <20261104022810.1484182-1-vulab@iscas.ac.cn> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="3542854"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:LGcZzo0JFkZy90JN4llxQbzfLQM= sha256:dVuGsD6oT6aj17cqMo27n/hGL/ihsH50qyfHBZFoltA= sha1:KPCgZUTOW/rsQhhwIfkUo9/ZwCQ= sha256:A196pDh06e9CWwzcCAjLD4iupRxXhQ6v2+upHh/7Ctc= 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 CCD00112E5B; Thu, 5 Nov 2026 05:27:59 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, 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 MWC5EGMzlMxc; Thu, 5 Nov 2026 05:27:55 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-356978-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id F1999112E56; Thu, 5 Nov 2026 05:27:45 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 69CE630D88; Wed, 4 Nov 2026 22:22:19 +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=1793830550; b=kfDqOToVds9WnBxB+3o2eUq0JDlySFPao39OMOm822g/mrS5sMzkHuEHBY8Y/JRR7V9s zJ3SK8zYLVhBRREiyHjU/NtD4iQY4y32F6bP0LMVodIBhki5rWKDAMrgHUQEDAgTrrxAZ 9Adnhn6OHOy0SsKSOpdhwA2JrKmVdj7uHQ5GkLFFIyEKy3FD2HkvQ5niNxQiD26/EYe9G epuImeFwXahC3ZJJ1F88r2k4PBbrJexiCMM1n4MUn6D0cdedqaIExPwnESY+6MR+NXFep r3l7tt61WUdtCYTOCUnq/LuDgf6oNLKNmvz6JVuQsWebiVw1ELwlQfdVVC398t5N+Vw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793830550; 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=3F2m60G+gxvBW4y7hHQfye8ccenVYUgHpUwX5iBXsZ8=; b=xSD8wdQCr4JMJRfokShrRgp8NoAb6CC9/5Y+RMVhLK7DYCAN3sQHTMHLavmZv+mtssUg 48hifBnI9DjflPhAEZ025znf9znYbMJ0WbYja70a+2Shty6re6LMR7RzZ4tQq/ZQq69ro EffncOld2ATKvzUeISw5NfzN2r7HY1hrC3DftLVyshM6xInfdBpPkrBeaSU08ysQ7J5Zu 5jd3QgJGGua5KU4tu7FZDHYkWC61pFNhsABIEgP4fFzvqYouOJk3AsYjgo9jor5MY+pEZ MAM6HDFbbfLvdIPfeZyu6qqMSR7/foy1nmVlrApRsVRX/P5oyddTQL2Uv6sNF1w6JGQ== 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=dJOZs+AM; 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 19A06606A852; Wed, 4 Nov 2026 22:15:50 +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=dJOZs+AM 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=1793830549; b=ihe9ra1Um2YrtJT2wG2neN2Ev2mRz2xtm2Us5e5ZBuBwRHgVKlVQGjItBPOqe6G1uHDY VN5gNnYMSXYc52RO429Vpv1PgvY10fU1dD4kzV71wD8qogjNS+HGqEO5gKveWQ9y4yvab ptFOQCYPZcV3aBHqVY2+CAkfz3pZPI58gnZwN6akM39l13iqFKU6vnJshs454Dc3j9J2b iJN99Kx5ZOwdX+bEQUo2++9QbELUHfwxEbUcxkm+yKufdtLfKvUXl+0dz3cU/lLEIoIO/ HC9RUts2C9Z3w0iJhLw0WC91LoHXjKJNhyaVSKKKH25biDQKDqOilg5BekLxP4URJMQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793830549; 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=3F2m60G+gxvBW4y7hHQfye8ccenVYUgHpUwX5iBXsZ8=; b=G9FngmTgHzFR7j365zDAAiBsEs/Fiqgq+T4FQPx57uyYjrZriLZh6/9t7FmfJJ4qE3Jj bHgiM9f3jBzNQzQArrxOW709YcMxCzwRpvhkt76ogIwveKkZmH7WxzLDmyEiVUlfH87+8 MPOWAO8kzsQwHXI3VCee0FtEgEaubzHI//gKOx1wn4sZxQHfloRoXX1wiBdTMv47GLFA8 v48MSVq3wf5BzBrfiR2/CTFO+ebqSNoZcPuvs9jGnS7kkUHrUhzKxlOhxkGwvNExdoShj XXp9VE99RbmpD/ymStPgBSkytcjH4tT5vbUXl/sfHtANbRKrks7p937eH7WoGHkZG9A== 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=dJOZs+AM; 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 B9A61606A333; Wed, 4 Nov 2026 22:15:48 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B53661F000C1; Wed, 4 Nov 2026 22:15:47 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793830548; bh=3F2m60G+gxvBW4y7hHQfye8ccenVYUgHpUwX5iBXsZ8=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=dJOZs+AM4zB+jYeDBNu+8sm5YhR0e3ZjPOxteGNYsvz1a/yShGJxsSdMMuKOAg8W6 JDB21X3tYBniVSMV95Q9/3YKfVHwgLQ7+LZt0oCeckS2VF6c2hVQC5DiutJa2C7PYS bYuVdfaB1zXEpyjMH+eoaONQyhn6aXKO67wxl/hdlLwrCcXTAYC4lMmh2Ft2w6DVjR J7metHeoA8E7rvU7K1jY7pGDLl+oqrsorvh4ryOdCmQ6SY6T4H1qhal/6zHf5OSS4S 7OmCEDUeRY0eSWjjMVNs2Iyzu3C3d6yGGOYBvV1MmyJb+Bs3yvIQG581tN52S7w9Nr GTNRMljkU+YaA== X-Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com X-In-Reply-To: <20261104022810.1484182-1-vulab@iscas.ac.cn> 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