[PATCHv5] nvme: allow to re-attach namespaces after all paths are down

Christoph Hellwig hch at lst.de
Tue Jun 8 09:42:47 PDT 2021


While I do like the look, I don't see how this could actually work:

>  	} else {
>  		ret = -EINVAL;
> -		if (!is_shared || !head->shared) {
> +		/*
> +		 * If multipath is enabled we might hit an ns head with no
> +		 * paths, but that doesn't indicate it's a shared namespace.
> +		 */
> +		if (!list_empty(&head->list) && (!is_shared || !head->shared)) {
>  			dev_err(ctrl->device,
>  				"Duplicate unshared namespace %d\n", nsid);
>  			goto out_put_ns_head;

When we get here with an existing ns_head with no namespaces attached
to it, we can assume it once had namespaces attached to it.  Because
of that NVME_NSHEAD_DISK_LIVE will be set, and we'll never add the
disk for it again.  Even if we did add the disk again what prevents
adding a disk and removing one from racing with each other?



More information about the Linux-nvme mailing list