[PATCHv2 2/2] nvme: translate zone resource errors

Keith Busch kbusch at kernel.org
Wed Sep 16 17:00:54 EDT 2020


On Tue, Sep 15, 2020 at 11:56:46PM +0000, Damien Le Moal wrote:
> On 2020/09/16 3:17, Keith Busch wrote:
> > Translate zoned resource errors to the appropriate blk_status_t.
> > 
> > Signed-off-by: Keith Busch <kbusch at kernel.org>
> > ---
> > v1->v2:
> > 
> >   Use BLK_STS_ZONE_RESOURCE instead of BLK_STS_DEV_RESOURCE
> > 
> >  drivers/nvme/host/core.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> > index f3a61a24d45f..6d5c95a3e03c 100644
> > --- a/drivers/nvme/host/core.c
> > +++ b/drivers/nvme/host/core.c
> > @@ -236,6 +236,9 @@ static blk_status_t nvme_error_status(u16 status)
> >  		return BLK_STS_NEXUS;
> >  	case NVME_SC_HOST_PATH_ERROR:
> >  		return BLK_STS_TRANSPORT;
> > +	case NVME_SC_ZONE_TOO_MANY_ACTIVE:
> > +	case NVME_SC_ZONE_TOO_MANY_OPEN:
> > +		return BLK_STS_ZONE_RESOURCE;
> 
> BLK_STS_ZONE_RESOURCE is used in the submission path to tell the block layer to
> "try again later because the target zone is locked". This is used by scsi for
> zone append emulation. So I think it may be better to define
> BLK_STS_DEV_ZONE_RESOURCE to avoid confusions, and that would also clearly
> indicate that the status comes from a command failed by the device, not the
> stack. Thoughts ?

I believe it's safe to use for the completion side since the special
handling is only for submission errors. But I agree this type of double
meaning could invite confusion. I'll send a v3 with your suggestion and
we'll see how that goes.



More information about the Linux-nvme mailing list