From: Keith Busch <kbusch@kernel.org>
To: Cen Zhang <zzzccc427@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>,
Steve Wise <larrystevenwise@gmail.com>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
baijiaju1990@gmail.com
Subject: Re: [PATCH v2] nvme-rdma: pin device wrapper in remove_one
Date: Mon, 22 Jun 2026 17:41:50 -0600 [thread overview]
Message-ID: <ajnIPsEIdnCZ8WBm@kbusch-mbp> (raw)
In-Reply-To: <20260622232131.3718076-1-zzzccc427@gmail.com>
On Tue, Jun 23, 2026 at 07:21:31AM +0800, Cen Zhang wrote:
> static void nvme_rdma_remove_one(struct ib_device *ib_device, void *client_data)
> {
> struct nvme_rdma_ctrl *ctrl;
> - struct nvme_rdma_device *ndev;
> - bool found = false;
> + struct nvme_rdma_device *ndev = NULL;
> + struct nvme_rdma_device *tmp;
>
> mutex_lock(&device_list_mutex);
> - list_for_each_entry(ndev, &device_list, entry) {
> - if (ndev->dev == ib_device) {
> - found = true;
> + list_for_each_entry(tmp, &device_list, entry) {
> + if (tmp->dev == ib_device && nvme_rdma_dev_get(tmp)) {
> + ndev = tmp;
> break;
I don't see the point of altering this loop to use a tmp variable.
Please just submit the minimal patch diff that fixes the issue without
introducing unnecessary changes.
> }
> }
> mutex_unlock(&device_list_mutex);
>
> - if (!found)
> + if (!ndev)
> return;
>
> /* Delete all controllers using this device */
> mutex_lock(&nvme_rdma_ctrl_mutex);
> list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list) {
> - if (ctrl->device->dev != ib_device)
> + if (ctrl->device != ndev)
> continue;
> nvme_delete_ctrl(&ctrl->ctrl);
> }
> mutex_unlock(&nvme_rdma_ctrl_mutex);
>
> flush_workqueue(nvme_delete_wq);
> + nvme_rdma_dev_put(ndev);
> }
>
> static struct ib_client nvme_rdma_ib_client = {
next prev parent reply other threads:[~2026-06-22 23:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 23:21 Cen Zhang
2026-06-22 23:41 ` Keith Busch [this message]
2026-06-22 23:49 ` Cen Zhang
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=ajnIPsEIdnCZ8WBm@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=axboe@kernel.dk \
--cc=baijiaju1990@gmail.com \
--cc=hch@lst.de \
--cc=larrystevenwise@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=zzzccc427@gmail.com \
/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
Powered by JetHome