[PATCH 1/4] nvme: simplify error logic in nvme_validate_ns()

Daniel Wagner dwagner at suse.de
Fri Feb 26 04:10:01 EST 2021


Hi Hannes,

On Fri, Feb 26, 2021 at 08:17:25AM +0100, Hannes Reinecke wrote:
> @@ -4045,7 +4045,7 @@ static void nvme_validate_ns(struct nvme_ns *ns, struct nvme_ns_ids *ids)
>  	if (ret)
>  		goto out;
>  
> -	ret = -ENODEV;
> +	ret = NVME_SC_INVALID_NS | NVME_SC_DNR;
>  	if (!nvme_ns_ids_equal(&ns->head->ids, ids)) {
>  		dev_err(ns->ctrl->device,
>  			"identifiers changed for nsid %d\n", ns->head->ns_id);
> @@ -4063,7 +4063,7 @@ static void nvme_validate_ns(struct nvme_ns *ns, struct nvme_ns_ids *ids)
>  	 *
>  	 * TODO: we should probably schedule a delayed retry here.
>  	 */
> -	if (ret && ret != -ENOMEM && !(ret > 0 && !(ret & NVME_SC_DNR)))
> +	if (ret > 0 && (ret & NVME_SC_DNR))
>  		nvme_ns_remove(ns);

I think Chao's comment still holds, nvme_update_ns_info() can return
-EINVAL, -IEO or -ENODEV. Don't we have to remove the NS in these
cases?

Thanks,
Daniel



More information about the Linux-nvme mailing list