Skip to contentSkip to conversation

nvme: translate zns errors to blk_status_t

PATCH In review Keith Busch 4 participants 15 messages Sep 9, 2020 – Sep 15, 2020 NVMe

lore
Share & tools
lore

Keith Busch

author maintainer
#0 lore raw

PATCH 1/1 nvme: translate zns errors to blk_status_t

EBUSY is the appropriate errno for commands that complete with zone resource errors.

---
 drivers/nvme/host/core.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/nvme/host/core.c +3 -0
index ea1fa41fbba8..aff556837115 100644
@@ -249,6 +249,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_DEV_RESOURCE;
 	default:
 		return BLK_STS_IOERR;
 	}
Signature · 7 lines
2.24.1


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Reviewed-by on v1 1/1
#2 lore raw
In reply to Keith Busch
Quoted 14 lines · Keith Busch

EBUSY is the appropriate errno for commands that complete with zone resource errors.

---
 drivers/nvme/host/core.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/nvme/host/core.c +0 -0
index ea1fa41fbba8..aff556837115 100644

drivers/nvme/host/core.c static blk_status_t nvme_error_status(u16 status) · line 257

Quoted 9 lines
drivers/nvme/host/core.c +3 -0
@@ -249,6 +249,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_DEV_RESOURCE;
 	default:
 		return BLK_STS_IOERR;
 	}

Perfect ! That fits nicely with what Johannes is working on with zonefs explicit zone open. I will check the scsi side to make sure the same is returned for too many open zones case.

Signature · 7 lines
Damien Le Moal
Western Digital Research

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
#3 lore raw
In reply to Keith Busch
Quoted 13 lines · Keith Busch

EBUSY is the appropriate errno for commands that complete with zone resource errors.

---
 drivers/nvme/host/core.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/nvme/host/core.c +0 -0
index ea1fa41fbba8..aff556837115 100644

drivers/nvme/host/core.c static blk_status_t nvme_error_status(u16 status) · line 254

Quoted 6 lines
drivers/nvme/host/core.c +3 -0
@@ -249,6 +249,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_DEV_RESOURCE;

I'm not sure this is the best idea, we probably need specific error codes if we want file systems to be aware of the limit.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author maintainer
#4 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 8 lines · Keith Busch

EBUSY is the appropriate errno for commands that complete with zone resource errors.

---
 drivers/nvme/host/core.c | 3 +++
 1 file changed, 3 insertions(+)
Quoted 14 lines

drivers/nvme/host/core.c static blk_status_t nvme_error_status(u16 status) · line 254

Quoted 11 lines
drivers/nvme/host/core.c +3 -0
index ea1fa41fbba8..aff556837115 100644
@@ -249,6 +249,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_DEV_RESOURCE;

I'm not sure this is the best idea, we probably need specific error codes if we want file systems to be aware of the limit.

I was more considering the errno the user sees going direct to the device.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#5 lore raw
In reply to Christoph Hellwig
Quoted 9 lines · Christoph Hellwig
Quoted 8 lines · Keith Busch

EBUSY is the appropriate errno for commands that complete with zone resource errors.

---
 drivers/nvme/host/core.c | 3 +++
 1 file changed, 3 insertions(+)
Quoted 14 lines

drivers/nvme/host/core.c static blk_status_t nvme_error_status(u16 status) · line 254

Quoted 11 lines
drivers/nvme/host/core.c +3 -0
index ea1fa41fbba8..aff556837115 100644
@@ -249,6 +249,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_DEV_RESOURCE;

I'm not sure this is the best idea, we probably need specific error codes if we want file systems to be aware of the limit.

Do you mean something else than -EBUSY being returned to the user by the block layer ? Or a different/specific BLK_STS_XXX code which translates into -EBUSY in blk_status_to_errno() ?

Signature · 7 lines
Damien Le Moal
Western Digital Research

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
#6 lore raw
Quoted 6 lines · Damien Le Moal
Quoted 2 lines

I'm not sure this is the best idea, we probably need specific error codes if we want file systems to be aware of the limit.

Do you mean something else than -EBUSY being returned to the user by the block layer ? Or a different/specific BLK_STS_XXX code which translates into -EBUSY in blk_status_to_errno() ?

My primary aim is a different BLK_STS_ code. But given that I think that we should not map different BLK_STS_ codes to the same errno if we can avoid it, we should probably also use a different errno.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#7 lore raw
Quoted 4 lines · Christoph Hellwig
Quoted 3 lines · Damien Le Moal
Quoted 2 lines

I'm not sure this is the best idea, we probably need specific error codes if we want file systems to be aware of the limit.

Quoted 8 lines
Quoted 3 lines

Do you mean something else than -EBUSY being returned to the user by the block layer ? Or a different/specific BLK_STS_XXX code which translates into -EBUSY in blk_status_to_errno() ?

My primary aim is a different BLK_STS_ code. But given that I think that we should not map different BLK_STS_ codes to the same errno if we can avoid it, we should probably also use a different errno.

Hmm. Beside EBUSY, I do not see a nice existing errno that we can reuse. May be ENOSR (out of stream resources) ? Or do we define a new one ? EZBUSY ?

And indeed if we define a new BLK_STS_ZONE_RESOURCE and map that to EBUSY, errno_to_blkstatus() will get confused.

Signature · 7 lines
Damien Le Moal
Western Digital Research

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
author maintainer
#8 lore raw
Quoted 14 lines · Damien Le Moal
Quoted 4 lines · Christoph Hellwig
Quoted 3 lines · Damien Le Moal
Quoted 2 lines

I'm not sure this is the best idea, we probably need specific error codes if we want file systems to be aware of the limit.

Quoted 8 lines
Quoted 3 lines

Do you mean something else than -EBUSY being returned to the user by the block layer ? Or a different/specific BLK_STS_XXX code which translates into -EBUSY in blk_status_to_errno() ?

My primary aim is a different BLK_STS_ code. But given that I think that we should not map different BLK_STS_ codes to the same errno if we can avoid it, we should probably also use a different errno.

Quoted 5 lines

Hmm. Beside EBUSY, I do not see a nice existing errno that we can reuse. May be ENOSR (out of stream resources) ? Or do we define a new one ? EZBUSY ?

And indeed if we define a new BLK_STS_ZONE_RESOURCE and map that to EBUSY, errno_to_blkstatus() will get confused.

It's not often I get to help define a new errno, so I'm a bit cautious of that route. But if that's the recommendation, then sure, sounds fun.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#9 lore raw
In reply to Damien Le Moal
Quoted 14 lines · Damien Le Moal
Quoted 4 lines · Christoph Hellwig
Quoted 3 lines · Damien Le Moal
Quoted 2 lines

I'm not sure this is the best idea, we probably need specific error codes if we want file systems to be aware of the limit.

Quoted 8 lines
Quoted 3 lines

Do you mean something else than -EBUSY being returned to the user by the block layer ? Or a different/specific BLK_STS_XXX code which translates into -EBUSY in blk_status_to_errno() ?

My primary aim is a different BLK_STS_ code. But given that I think that we should not map different BLK_STS_ codes to the same errno if we can avoid it, we should probably also use a different errno.

Quoted 5 lines

Hmm. Beside EBUSY, I do not see a nice existing errno that we can reuse. May be ENOSR (out of stream resources) ? Or do we define a new one ? EZBUSY ?

And indeed if we define a new BLK_STS_ZONE_RESOURCE and map that to EBUSY, errno_to_blkstatus() will get confused.

Yes, you need to pick a new error. I don't really care which one, most of the mappings are pretty odd anyway.

Quoted 5 lines
Signature · 3 lines
-- 
Damien Le Moal
Western Digital Research

---end quoted text---

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

author maintainer
#10 lore raw
Quoted 15 lines · Christoph Hellwig
Quoted 14 lines · Damien Le Moal
Quoted 12 lines · Christoph Hellwig
Quoted 6 lines · Damien Le Moal
Quoted 2 lines

I'm not sure this is the best idea, we probably need specific error codes if we want file systems to be aware of the limit.

Do you mean something else than -EBUSY being returned to the user by the block layer ? Or a different/specific BLK_STS_XXX code which translates into -EBUSY in blk_status_to_errno() ?

My primary aim is a different BLK_STS_ code. But given that I think that we should not map different BLK_STS_ codes to the same errno if we can avoid it, we should probably also use a different errno.

Quoted 8 lines
Quoted 5 lines

Hmm. Beside EBUSY, I do not see a nice existing errno that we can reuse. May be ENOSR (out of stream resources) ? Or do we define a new one ? EZBUSY ?

And indeed if we define a new BLK_STS_ZONE_RESOURCE and map that to EBUSY, errno_to_blkstatus() will get confused.

Yes, you need to pick a new error. I don't really care which one, most of the mappings are pretty odd anyway.

Selecting an existing unused errno feels a bit arbitrary for a status that is currently specific to NVMe ZNS. Could you provide a little more guidance on what you're looking for?

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#11 lore raw
Quoted 22 lines · Keith Busch
Quoted 21 lines · Christoph Hellwig
Quoted 19 lines · Damien Le Moal
Quoted 4 lines · Christoph Hellwig
Quoted 3 lines · Damien Le Moal
Quoted 2 lines

I'm not sure this is the best idea, we probably need specific error codes if we want file systems to be aware of the limit.

Quoted 8 lines
Quoted 3 lines

Do you mean something else than -EBUSY being returned to the user by the block layer ? Or a different/specific BLK_STS_XXX code which translates into -EBUSY in blk_status_to_errno() ?

My primary aim is a different BLK_STS_ code. But given that I think that we should not map different BLK_STS_ codes to the same errno if we can avoid it, we should probably also use a different errno.

Hmm. Beside EBUSY, I do not see a nice existing errno that we can reuse. May be ENOSR (out of stream resources) ? Or do we define a new one ? EZBUSY ?

And indeed if we define a new BLK_STS_ZONE_RESOURCE and map that to EBUSY, errno_to_blkstatus() will get confused.

Quoted 6 lines
Quoted 2 lines

Yes, you need to pick a new error. I don't really care which one, most of the mappings are pretty odd anyway.

Selecting an existing unused errno feels a bit arbitrary for a status that is currently specific to NVMe ZNS. Could you provide a little more guidance on what you're looking for?

Not just NVMe ZNS. SCSI/ZBC and ATA/ZAC too (both sd driver) :)

Signature · 7 lines
Damien Le Moal
Western Digital Research

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
author maintainer
#12 lore raw
Quoted 6 lines · Damien Le Moal
Quoted 3 lines · Keith Busch

Selecting an existing unused errno feels a bit arbitrary for a status that is currently specific to NVMe ZNS. Could you provide a little more guidance on what you're looking for?

Not just NVMe ZNS. SCSI/ZBC and ATA/ZAC too (both sd driver) :)

Gotcha, I did not realize those may have open zone limits too.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#13 lore raw
Quoted 9 lines · Keith Busch
Quoted 6 lines · Damien Le Moal
Quoted 3 lines · Keith Busch

Selecting an existing unused errno feels a bit arbitrary for a status that is currently specific to NVMe ZNS. Could you provide a little more guidance on what you're looking for?

Not just NVMe ZNS. SCSI/ZBC and ATA/ZAC too (both sd driver) :)

Gotcha, I did not realize those may have open zone limits too.

ZBC/ZAC both define a max open zone limit too, which is semantically equivalent to ZNS definition. ZBC and ZAC do not define the active zone concept though, so no limit set for max_active_zones.

Signature · 7 lines
Damien Le Moal
Western Digital Research

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
#14 lore raw
In reply to Keith Busch
Quoted 6 lines · Keith Busch
Quoted 2 lines

Yes, you need to pick a new error. I don't really care which one, most of the mappings are pretty odd anyway.

Selecting an existing unused errno feels a bit arbitrary for a status that is currently specific to NVMe ZNS. Could you provide a little more guidance on what you're looking for?

As said before: most of the errno mappins are pretty arbitrary, e.g. take a look at the -ENOLINK, -EREMOTEIO, -EBADE, -ENODATA, -EILSEQ, or -EREMCHG mappings.

So I think just picking a value like ECHRNG or EBADSLT or EUSERS should be perfectly fine.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme