Skip to contentSkip to conversation

nvme: re-fix error-handling for io_uring nvme-passthrough

PATCH In review Keith Busch 6 participants 6 messages Oct 28, 2024 – Oct 29, 2024 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: re-fix error-handling for io_uring nvme-passthrough

From: Keith Busch <[email protected]>

This was previously fixed with commit 1147dd0503564fa0e0348 ("nvme: fix error-handling for io_uring nvme-passthrough"), but the change was mistakenly undone in a later commit.

Fixes d6aacee9255e7f ("nvme: use bio_integrity_map_user"
---
 drivers/nvme/host/ioctl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/nvme/host/ioctl.c +5 -1
index b9b79ccfabf8a..6c531088043b7 100644
@@ -422,9 +422,13 @@ static enum rq_end_io_ret nvme_uring_cmd_end_io(struct request *req,
 	struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
 
 	if (nvme_req(req)->flags & NVME_REQ_CANCELLED)
+	if (nvme_req(req)->flags & NVME_REQ_CANCELLED) {
 		pdu->status = -EINTR;
-	else
+	} else {
 		pdu->status = nvme_req(req)->status;
+		if (!pdu->status)
+			pdu->status = blk_status_to_errno(err);
+	}
 	pdu->result = le64_to_cpu(nvme_req(req)->result.u64);
 
 	/*
Signature · 1 line
2.43.5
maintainer
#1 lore raw
Quoted 9 lines · Keith Busch

From: Keith Busch <[email protected]>

This was previously fixed with commit 1147dd0503564fa0e0348 ("nvme: fix error-handling for io_uring nvme-passthrough"), but the change was mistakenly undone in a later commit.

Fixes d6aacee9255e7f ("nvme: use bio_integrity_map_user"

Looks good to me, but needs a:

to ensure it hits stable as well.

Signature · 1 line
Jens Axboe
Reviewed-by on v1 1/1
#3 lore raw
In reply to Keith Busch
Quoted 34 lines · Keith Busch

From: Keith Busch <[email protected]>

This was previously fixed with commit 1147dd0503564fa0e0348 ("nvme: fix error-handling for io_uring nvme-passthrough"), but the change was mistakenly undone in a later commit.

Fixes d6aacee9255e7f ("nvme: use bio_integrity_map_user"
---
 drivers/nvme/host/ioctl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/nvme/host/ioctl.c +5 -1
index b9b79ccfabf8a..6c531088043b7 100644
@@ -422,9 +422,13 @@ static enum rq_end_io_ret nvme_uring_cmd_end_io(struct request *req,
 	struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
 
 	if (nvme_req(req)->flags & NVME_REQ_CANCELLED)
+	if (nvme_req(req)->flags & NVME_REQ_CANCELLED) {
 		pdu->status = -EINTR;
-	else
+	} else {
 		pdu->status = nvme_req(req)->status;
+		if (!pdu->status)
+			pdu->status = blk_status_to_errno(err);
+	}
 	pdu->result = le64_to_cpu(nvme_req(req)->result.u64);
 
 	/*
Signature · 1 line
2.43.5
maintainer
#5 lore raw
In reply to Keith Busch

drivers/nvme/host/ioctl.c static enum rq_end_io_ret nvme_uring_cmd_end_io(struct request *req, · line 425

Quoted 5 lines · Keith Busch
drivers/nvme/host/ioctl.c +1 -0
@@ -422,9 +422,13 @@ static enum rq_end_io_ret nvme_uring_cmd_end_io(struct request *req,
 	struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
 
 	if (nvme_req(req)->flags & NVME_REQ_CANCELLED)
+	if (nvme_req(req)->flags & NVME_REQ_CANCELLED) {

There should have been a '-' sign in front of that first if statement. Fixed up and pushed to nvme-6.12.