On Thu, Apr 09, 2020 at 04:16:19PM +0200, Miklos Szeredi wrote: > Solve this by adding a cursor entry for each open instance. Taking the > global namespace_sem for write seems excessive, since we are only dealing > with a per-namespace list. Instead add a per-namespace spinlock and use > that together with namespace_sem taken for read to protect against > concurrent modification of the mount list. This may reduce parallelism of It occurs to me that this is another place where something like Kent's SIX locks would fit the bill. To recap, that was a mutex with Shared, Intent-to-upgrade and eXclusive states. eXclusive and Shared are like write and read states in our rwsem. The Intent state would allow other Shared users to start, but no more Intent users. You'd have to upgrade to eXclusive state to actually modify the list, so you might have to wait for Shared users to finish the section. Might not work out well in practice for this user, but thought it was worth mentioning.