[PATCH v2 for-5.8-rc 2/6] nvme-multipath: fix deadlock between ana_work and scan_work

Sagi Grimberg sagi at grimberg.me
Wed Jun 24 02:56:50 EDT 2020


>> -static int nvme_set_ns_ana_state(struct nvme_ctrl *ctrl,
>> +static int nvme_get_ns_ana_state(struct nvme_ctrl *ctrl,
>>   		struct nvme_ana_group_desc *desc, void *data)
> 
> Maybe this should be called nvme_lookup_ana_group_desc or so given that
> it doesn't actually do anything about the state?

Agree, reads much better.

> 
>>   {
>> -	struct nvme_ns *ns = data;
>> +	struct nvme_ana_group_desc *dst = data;
>>   
>> -	if (ns->ana_grpid == le32_to_cpu(desc->grpid)) {
>> -		nvme_update_ns_ana_state(desc, ns);
>> +	if (desc->grpid == dst->grpid) {
>> +		*dst = *desc;
>>   		return -ENXIO; /* just break out of the loop */
>>   	}
> 
> Any maybe doing the early return here would also clarify things:
> 
> 	if (desc->grpid != dst->grpid)
> 		return 0;
> 	*dst = *desc;
> 	return -ENXIO; /* just break out of the loop */
> 
> Otherwise this looks good.

Will fix.



More information about the Linux-nvme mailing list