[PATCH] nvme: don't create a multipath node for zero capacity devices

Nilay Shroff nilay at linux.ibm.com
Wed Apr 3 06:40:01 PDT 2024



On 4/3/24 18:17, Christoph Hellwig wrote:
> Apparently there are nvme controllers around that report namespaces
> in the namespace list which have zero capacity.  Return -ENXIO instead
> of -ENODEV from nvme_update_ns_info_block so we don't create a hidden
> multipath node for these namespaces but entirely ignore them.
> 
> Fixes: 46e7422cda84 ("nvme: move common logic into nvme_update_ns_info")
> Reported-by: Nilay Shroff <nilay at linux.ibm.com>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
>  drivers/nvme/host/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 3b0498f320e6b9..ad60cf5581a419 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2089,7 +2089,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
>  	if (id->ncap == 0) {
>  		/* namespace not allocated or attached */
>  		info->is_removed = true;
> -		ret = -ENODEV;
> +		ret = -ENXIO;
>  		goto out;
>  	}
>  	lbaf = nvme_lbaf_index(id->flbas);
I have tested patch on my controller with zero capacity namespaces.
This looks good and fixing the issue reported here: 
https://lore.kernel.org/all/c0750d96-6bae-46b5-a1cc-2ff9d36eccb3@linux.ibm.com/

Tested-by: Nilay Shroff <nilay at linux.ibm.com>

Thanks,
--Nilay



More information about the Linux-nvme mailing list