Skip to contentSkip to conversation

nvme: fix error-handling for io_uring nvme-passthrough

PATCH In review Kanchan Joshi 4 participants 5 messages Oct 18, 2023 – Nov 6, 2023 1 message not in the archive NVMe

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20231018193056epcas5p404b1fb38d3e9037862703690336d2d10@epcas5p4.samsung.com

#1 lore raw

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

From: Anuj Gupta <[email protected]>

Driver may return an error before submitting the command to the device. Ensure that such error is propagated up.

Fixes 456cba386e94 ("nvme: wire-up uring-cmd support for io-passthru on char-device.")

---
Changes since v1:
- Coding and comment style change (Niklas)

 drivers/nvme/host/ioctl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/nvme/host/ioctl.c +5 -2
index d8ff796fd5f2..92273a5a2202 100644
@@ -506,10 +506,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);
 
 	req->bio = pdu->bio;
-	if (nvme_req(req)->flags & NVME_REQ_CANCELLED)
+	if (nvme_req(req)->flags & NVME_REQ_CANCELLED) {
 		pdu->nvme_status = -EINTR;
-	else
+	} else {
 		pdu->nvme_status = nvme_req(req)->status;
+		if (!pdu->nvme_status)
+			pdu->nvme_status = blk_status_to_errno(err);
+	}
 	pdu->u.result = le64_to_cpu(nvme_req(req)->result.u64);
 
 	/*
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#3 lore raw
In reply to Kanchan Joshi
Quoted 38 lines · Kanchan Joshi

From: Anuj Gupta <[email protected]>

Driver may return an error before submitting the command to the device. Ensure that such error is propagated up.

Fixes 456cba386e94 ("nvme: wire-up uring-cmd support for io-passthru on char-device.")

---
Changes since v1:
- Coding and comment style change (Niklas)

 drivers/nvme/host/ioctl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/nvme/host/ioctl.c +5 -2
index d8ff796fd5f2..92273a5a2202 100644
@@ -506,10 +506,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);
 
 	req->bio = pdu->bio;
-	if (nvme_req(req)->flags & NVME_REQ_CANCELLED)
+	if (nvme_req(req)->flags & NVME_REQ_CANCELLED) {
 		pdu->nvme_status = -EINTR;
-	else
+	} else {
 		pdu->nvme_status = nvme_req(req)->status;
+		if (!pdu->nvme_status)
+			pdu->nvme_status = blk_status_to_errno(err);
+	}
 	pdu->u.result = le64_to_cpu(nvme_req(req)->result.u64);
 
 	/*
Signature · 1 line
2.25.1
maintainer
#5 lore raw
Quoted 3 lines · Kanchan Joshi

Keith,

Can this be picked?

Got it queued up now, thank you for the reminder.