[PATCH] nvme: fix namespace removal list
Christoph Hellwig
hch at lst.de
Tue Jun 11 09:39:55 PDT 2024
On Tue, Jun 11, 2024 at 08:20:55AM -0700, Keith Busch wrote:
> 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_del_rcu(&ns->list);
> + list_add_tail_rcu(&ns->list, &rm_list);
> + }
Is this actually valid for a (S)RCU protected list? If the entry gets
added to the new list before the grace period has completed, we could
trick a concurrent traversal into following the new list unless I'm
mistaken (although chances I'm mistaken on RCU corner cases aren't that
low..).
More information about the Linux-nvme
mailing list