Skip to content

Commit 1147dd0

Browse files
Anuj Guptakeithbusch
authored andcommitted
nvme: fix error-handling for io_uring nvme-passthrough
Driver may return an error before submitting the command to the device. Ensure that such error is propagated up. Fixes: 456cba3 ("nvme: wire-up uring-cmd support for io-passthru on char-device.") Signed-off-by: Anuj Gupta <[email protected]> Signed-off-by: Kanchan Joshi <[email protected]> Reviewed-by: Niklas Cassel <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 983a338 commit 1147dd0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/nvme/host/ioctl.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,13 @@ static enum rq_end_io_ret nvme_uring_cmd_end_io(struct request *req,
510510
struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
511511

512512
req->bio = pdu->bio;
513-
if (nvme_req(req)->flags & NVME_REQ_CANCELLED)
513+
if (nvme_req(req)->flags & NVME_REQ_CANCELLED) {
514514
pdu->nvme_status = -EINTR;
515-
else
515+
} else {
516516
pdu->nvme_status = nvme_req(req)->status;
517+
if (!pdu->nvme_status)
518+
pdu->nvme_status = blk_status_to_errno(err);
519+
}
517520
pdu->u.result = le64_to_cpu(nvme_req(req)->result.u64);
518521

519522
/*

0 commit comments

Comments
 (0)