From: Keith Busch <kbusch@meta.com>
To: <linux-nvme@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>
Cc: <hch@lst.de>, <sagi@grimberg.me>, <paulmck@kernel.org>,
<davidgow@google.com>, <akpm@linux-foundation.org>,
<venkat88@linux.vnet.ibm.com>, Keith Busch <kbusch@kernel.org>
Subject: [PATCH 2/2] nvme: fix namespace removal list
Date: Wed, 12 Jun 2024 08:51:35 -0700 [thread overview]
Message-ID: <20240612155135.3060667-2-kbusch@meta.com> (raw)
In-Reply-To: <20240612155135.3060667-1-kbusch@meta.com>
From: Keith Busch <kbusch@kernel.org>
This function wants to move a subset of a list from an element to the
end to another list, so do that with the new list_cut helper instead of
using the wrong list splice.
Fixes: be647e2c76b27f4 ("nvme: use srcu for iterating namespace list")
Reported-by: Venkat Rao Bagalkote <venkat88@linux.vnet.ibm.com>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.vnet.ibm.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/nvme/host/core.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f5d150c62955d..30fec15872b3d 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3959,9 +3959,10 @@ static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl,
mutex_lock(&ctrl->namespaces_lock);
list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) {
- if (ns->head->ns_id > nsid)
- list_splice_init_rcu(&ns->list, &rm_list,
- synchronize_rcu);
+ if (ns->head->ns_id > nsid) {
+ list_cut(&rm_list, &ctrl->namespaces, &ns->list);
+ break;
+ }
}
mutex_unlock(&ctrl->namespaces_lock);
synchronize_srcu(&ctrl->srcu);
--
2.43.0
next prev parent reply other threads:[~2024-06-12 15:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-12 15:51 [PATCH 1/2] list: introduce a new cutting helper Keith Busch
2024-06-12 15:51 ` Keith Busch [this message]
2024-06-12 17:20 ` [PATCH 2/2] nvme: fix namespace removal list Chaitanya Kulkarni
2024-06-12 17:24 ` Keith Busch
2024-06-12 17:19 ` [PATCH 1/2] list: introduce a new cutting helper Chaitanya Kulkarni
2024-06-13 4:56 ` Nilay Shroff
2024-06-13 8:10 ` Christoph Hellwig
2024-06-13 13:00 ` Keith Busch
2024-06-13 12:56 ` Keith Busch
2024-06-13 13:41 ` Nilay Shroff
2024-06-13 14:36 ` Keith Busch
2024-06-13 14:43 ` Paul E. McKenney
2024-06-13 14:47 ` Keith Busch
2024-06-13 15:15 ` Paul E. McKenney
2024-06-13 15:40 ` Keith Busch
2024-06-13 16:01 ` Paul E. McKenney
2024-06-13 16:10 ` Keith Busch
2024-06-13 17:39 ` Paul E. McKenney
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=20240612155135.3060667-2-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=akpm@linux-foundation.org \
--cc=davidgow@google.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=paulmck@kernel.org \
--cc=sagi@grimberg.me \
--cc=venkat88@linux.vnet.ibm.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