Skip to content

Commit ff0ffe5

Browse files
committed
nvme: fix namespace removal list
This function wants to move a subset of a list from one element to the tail into another list. It also needs to use the srcu synchronize instead of the regular rcu version. Do this one element at a time because that's the only to do it. Fixes: be647e2 ("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>
1 parent cd0c1b8 commit ff0ffe5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/nvme/host/core.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3960,12 +3960,13 @@ static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl,
39603960

39613961
mutex_lock(&ctrl->namespaces_lock);
39623962
list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) {
3963-
if (ns->head->ns_id > nsid)
3964-
list_splice_init_rcu(&ns->list, &rm_list,
3965-
synchronize_rcu);
3963+
if (ns->head->ns_id > nsid) {
3964+
list_del_rcu(&ns->list);
3965+
synchronize_srcu(&ctrl->srcu);
3966+
list_add_tail_rcu(&ns->list, &rm_list);
3967+
}
39663968
}
39673969
mutex_unlock(&ctrl->namespaces_lock);
3968-
synchronize_srcu(&ctrl->srcu);
39693970

39703971
list_for_each_entry_safe(ns, next, &rm_list, list)
39713972
nvme_ns_remove(ns);

0 commit comments

Comments
 (0)