[PATCH v2] nvme: fix error handling in nvme_ns_report_zones

Christoph Hellwig hch at lst.de
Mon Aug 31 02:17:20 EDT 2020


On Mon, Aug 31, 2020 at 12:20:43AM +0000, Damien Le Moal wrote:
> On 2020/08/30 19:25, Christoph Hellwig wrote:
> > nvme_submit_sync_cmd can return positive NVMe error codes in addition to
> > the negative Linux error code, which are currently ignored.  Fix this
> > by removing __nvme_ns_report_zones and handling the errors from
> > nvme_submit_sync_cmd in the caller instead of multiplexing the return
> > value and the zone size into a single return value.
> 
> s/zone size/number of zones reported/

Yes.

> > +		c.zmr.slba = cpu_to_le64(nvme_sect_to_lba(ns, sector));
> > +		ret = nvme_submit_sync_cmd(ns->queue, &c, report, buflen);
> > +		if (ret)
> >  			goto out_free;
> 
> Isn't there a problem here ? goto out_free will do "return ret;" and if ret is a
> positive error code, then that value will be interpreted as a number of zones
> reported. ret must be a standard "-Exxx" error code since this is a file method
> and the caller does not expect an NVMe error code.

Yes, we'll need to translate the nvme to a Linux status first.



More information about the Linux-nvme mailing list