[PATCH] nvmet: Fix possible infinite loop triggered on hot namespace removal

Christoph Hellwig hch at infradead.org
Tue Nov 1 06:43:52 PDT 2016


>  void nvmet_ns_disable(struct nvmet_ns *ns)
> @@ -324,13 +324,10 @@ void nvmet_ns_disable(struct nvmet_ns *ns)
>  	struct nvmet_subsys *subsys = ns->subsys;
>  	struct nvmet_ctrl *ctrl;
>  
> -	mutex_lock(&subsys->lock);
> -	if (list_empty(&ns->dev_link)) {
> -		mutex_unlock(&subsys->lock);
> +	if (!test_and_clear_bit(NVMET_NS_ENABLED, &ns->flags))
>  		return;
> -	}
> -	list_del_init(&ns->dev_link);
> -	mutex_unlock(&subsys->lock);
> +
> +	list_del_rcu(&ns->dev_link);

We'll still need the lock here, don't we?



More information about the Linux-nvme mailing list