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

Hannes Reinecke hare at suse.de
Fri Feb 26 04:24:46 EST 2021


On 2/26/21 10:10 AM, Daniel Wagner wrote:
> 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?
> 
I thought I had fixed up all instances where we can return -ENODEV; and 
all others are indeed transport or transient error which should not 
result in a namespace removal.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare at suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer



More information about the Linux-nvme mailing list