On Tue, Jun 11, 2024 at 10:40:13PM +0530, Nilay Shroff wrote: > > > On 6/11/24 22:09, Christoph Hellwig wrote: > > 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..). > > > > > I think we need synchronize_srcu() before we add deleted ns to rm_list. After we delete it, but yes. There will also be a window during which the element is not in either list, but given the name "rm_list", I am guessing that this is OK. ;-) Thanx, Paul