All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 1/2] block: map BLK_STS_ZONE_RESOURCE to errno
@ 2020-09-15 18:12 Keith Busch
  2020-09-15 18:12 ` [PATCHv2 2/2] nvme: translate zone resource errors Keith Busch
  2020-09-15 23:59 ` [PATCHv2 1/2] block: map BLK_STS_ZONE_RESOURCE to errno Damien Le Moal
  0 siblings, 2 replies; 7+ messages in thread
From: Keith Busch @ 2020-09-15 18:12 UTC (permalink / raw)
  To: linux-nvme, sagi, hch; +Cc: axboe, Keith Busch

A zoned device with limited resources to open zones for writing may
return an error when the host exceeds those limits. Provide an
appropriate errno for this condition for drivers that return the zone
resource block status error when the device responds with these
conditions.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
v1->v2:

  Pick an errno to map BLK_STS_ZONE_RESOURCE

 block/blk-core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/blk-core.c b/block/blk-core.c
index 10c08ac50697..3594efe05117 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -186,6 +186,9 @@ static const struct {
 	/* device mapper special case, should not leak out: */
 	[BLK_STS_DM_REQUEUE]	= { -EREMCHG, "dm internal retry" },
 
+	/* too many zone resources in use */
+	[BLK_STS_ZONE_RESOURCE]	= { -ETOOMANYREFS, "zone resource exceeded" },
+
 	/* everything else not covered above: */
 	[BLK_STS_IOERR]		= { -EIO,	"I/O" },
 };
-- 
2.24.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv2 2/2] nvme: translate zone resource errors
  2020-09-15 18:12 [PATCHv2 1/2] block: map BLK_STS_ZONE_RESOURCE to errno Keith Busch
@ 2020-09-15 18:12 ` Keith Busch
  2020-09-15 23:56   ` Damien Le Moal
  2020-09-15 23:59 ` [PATCHv2 1/2] block: map BLK_STS_ZONE_RESOURCE to errno Damien Le Moal
  1 sibling, 1 reply; 7+ messages in thread
From: Keith Busch @ 2020-09-15 18:12 UTC (permalink / raw)
  To: linux-nvme, sagi, hch; +Cc: axboe, Keith Busch

Translate zoned resource errors to the appropriate blk_status_t.

Signed-off-by: Keith Busch <kbusch@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;
 	default:
 		return BLK_STS_IOERR;
 	}
-- 
2.24.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCHv2 2/2] nvme: translate zone resource errors
  2020-09-15 18:12 ` [PATCHv2 2/2] nvme: translate zone resource errors Keith Busch
@ 2020-09-15 23:56   ` Damien Le Moal
  2020-09-16 21:00     ` Keith Busch
  0 siblings, 1 reply; 7+ messages in thread
From: Damien Le Moal @ 2020-09-15 23:56 UTC (permalink / raw)
  To: Keith Busch, linux-nvme@lists.infradead.org, sagi@grimberg.me,
	hch@lst.de
  Cc: axboe@kernel.dk

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@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 ?


>  	default:
>  		return BLK_STS_IOERR;
>  	}
> 


-- 
Damien Le Moal
Western Digital Research

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCHv2 1/2] block: map BLK_STS_ZONE_RESOURCE to errno
  2020-09-15 18:12 [PATCHv2 1/2] block: map BLK_STS_ZONE_RESOURCE to errno Keith Busch
  2020-09-15 18:12 ` [PATCHv2 2/2] nvme: translate zone resource errors Keith Busch
@ 2020-09-15 23:59 ` Damien Le Moal
  1 sibling, 0 replies; 7+ messages in thread
From: Damien Le Moal @ 2020-09-15 23:59 UTC (permalink / raw)
  To: Keith Busch, linux-nvme@lists.infradead.org, sagi@grimberg.me,
	hch@lst.de
  Cc: axboe@kernel.dk

On 2020/09/16 3:20, Keith Busch wrote:
> A zoned device with limited resources to open zones for writing may
> return an error when the host exceeds those limits. Provide an
> appropriate errno for this condition for drivers that return the zone
> resource block status error when the device responds with these
> conditions.
> 
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
> v1->v2:
> 
>   Pick an errno to map BLK_STS_ZONE_RESOURCE
> 
>  block/blk-core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 10c08ac50697..3594efe05117 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -186,6 +186,9 @@ static const struct {
>  	/* device mapper special case, should not leak out: */
>  	[BLK_STS_DM_REQUEUE]	= { -EREMCHG, "dm internal retry" },
>  
> +	/* too many zone resources in use */
> +	[BLK_STS_ZONE_RESOURCE]	= { -ETOOMANYREFS, "zone resource exceeded" },

OK. I think this is somewhat matching. The error message that strerrror()
returns for this error will be somewhat obscure to users though. We need to
document this.

> +
>  	/* everything else not covered above: */
>  	[BLK_STS_IOERR]		= { -EIO,	"I/O" },
>  };
> 


-- 
Damien Le Moal
Western Digital Research

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCHv2 2/2] nvme: translate zone resource errors
  2020-09-15 23:56   ` Damien Le Moal
@ 2020-09-16 21:00     ` Keith Busch
  2020-09-17  5:48       ` hch
  0 siblings, 1 reply; 7+ messages in thread
From: Keith Busch @ 2020-09-16 21:00 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: axboe@kernel.dk, sagi@grimberg.me, linux-nvme@lists.infradead.org,
	hch@lst.de

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@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.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCHv2 2/2] nvme: translate zone resource errors
  2020-09-16 21:00     ` Keith Busch
@ 2020-09-17  5:48       ` hch
  2020-09-17  6:14         ` Damien Le Moal
  0 siblings, 1 reply; 7+ messages in thread
From: hch @ 2020-09-17  5:48 UTC (permalink / raw)
  To: Keith Busch
  Cc: axboe@kernel.dk, Damien Le Moal, sagi@grimberg.me,
	linux-nvme@lists.infradead.org, hch@lst.de

On Wed, Sep 16, 2020 at 02:00:54PM -0700, Keith Busch wrote:
> 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.

Two remarks:  Can you include the scsi patch for Damien so that ZNS
and ZBC/ZAC are handled together?  Should we use a separate status
for active vs open zones?

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCHv2 2/2] nvme: translate zone resource errors
  2020-09-17  5:48       ` hch
@ 2020-09-17  6:14         ` Damien Le Moal
  0 siblings, 0 replies; 7+ messages in thread
From: Damien Le Moal @ 2020-09-17  6:14 UTC (permalink / raw)
  To: hch@lst.de, Keith Busch
  Cc: axboe@kernel.dk, sagi@grimberg.me, linux-nvme@lists.infradead.org

On 2020/09/17 14:48, hch@lst.de wrote:
> On Wed, Sep 16, 2020 at 02:00:54PM -0700, Keith Busch wrote:
>> 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.
> 
> Two remarks:  Can you include the scsi patch for Damien so that ZNS
> and ZBC/ZAC are handled together?  Should we use a separate status
> for active vs open zones?

I did not think about that... It will not matter for ZBC/ZAC since there is no
limit on active zones, but that indeed could be useful for ZNS. And with
Johannes "explicit_open" series for zonefs, open() of a zonefs file would return
different error codes to the application for max open exceeded vs max active
exceeded. Same for raw block devices ioctls or write operations.

Hmm. So we need 2 BLK_STS and 2 errno. Not a big change but I am out of idea for
the second errno... EOVERFLOW for max active error ?

Max open zones error: BLK_STS_ZONE_MOR -> ETOOMANYREFS
Mac active zones error: BLK_STS_ZONE_MAR -> EOVERFLOW

May be.

-- 
Damien Le Moal
Western Digital Research

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-17  6:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-15 18:12 [PATCHv2 1/2] block: map BLK_STS_ZONE_RESOURCE to errno Keith Busch
2020-09-15 18:12 ` [PATCHv2 2/2] nvme: translate zone resource errors Keith Busch
2020-09-15 23:56   ` Damien Le Moal
2020-09-16 21:00     ` Keith Busch
2020-09-17  5:48       ` hch
2020-09-17  6:14         ` Damien Le Moal
2020-09-15 23:59 ` [PATCHv2 1/2] block: map BLK_STS_ZONE_RESOURCE to errno Damien Le Moal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.