Thread (20 messages) 20 messages, 5 authors, 2021-05-17

Re: [PATCHv2 4/5] nvme: use return value from blk_execute_rq()

From: Yuanyuan Zhong <hidden>
Date: 2021-04-26 17:10:24
Also in: linux-nvme

On Fri, Apr 23, 2021 at 3:06 PM Keith Busch [off-list ref] wrote:
quoted hunk ↗ jump to hunk
We don't have an nvme status to report if the driver's .queue_rq()
returns an error without dispatching the requested nvme command. Use the
return value from blk_execute_rq() for all passthrough commands so the
caller may know their command was not successful.

If the command is from the target passthrough interface and fails to
dispatch, synthesize the response back to the host as a internal target
error.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 drivers/nvme/host/core.c       | 16 ++++++++++++----
 drivers/nvme/host/ioctl.c      |  6 +-----
 drivers/nvme/host/nvme.h       |  2 +-
 drivers/nvme/target/passthru.c |  8 ++++----
 4 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 10bb8406e067..62af5fe7a0ce 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -972,12 +972,12 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
                        goto out;
        }

-       blk_execute_rq(NULL, req, at_head);
+       ret = blk_execute_rq(NULL, req, at_head);
        if (result)
                *result = nvme_req(req)->result;
        if (nvme_req(req)->flags & NVME_REQ_CANCELLED)
                ret = -EINTR;
-       else
+       else if (nvme_req(req)->status)
Since nvme_req(req)->status is uninitialized for a command failed to dispatch,
it's valid only if ret from blk_execute_rq() is 0.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help