[RFC PATCH] nvme: use NS head lock to serialize access to NS list

Keith Busch kbusch at kernel.org
Mon Jan 26 09:08:02 PST 2026


On Mon, Jan 26, 2026 at 04:45:52PM +0000, John Garry wrote:
> @@ -702,12 +702,12 @@ static void nvme_remove_head_work(struct work_struct *work)
>  			struct nvme_ns_head, remove_work);
>  	bool remove = false;
>  
> -	mutex_lock(&head->subsys->lock);
> +	mutex_lock(&head->lock);
>  	if (list_empty(&head->list)) {
>  		list_del_init(&head->entry);

The head->entry is linked into the subsystem's "nsheads" list, so at
least access to that still needs to happen under the subsys->lock.

The other lock changes constrained to the head->list usage look fine.



More information about the Linux-nvme mailing list