From: Christoph Hellwig <hch@lst.de>
To: Keith Busch <kbusch@kernel.org>, Sagi Grimberg <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>
Cc: Kanchan Joshi <joshi.k@samsung.com>, linux-nvme@lists.infradead.org
Subject: [PATCH 3/7] nvmet: allow async passthrough of commands that change logical block contents
Date: Tue, 13 Dec 2022 17:24:49 +0100 [thread overview]
Message-ID: <20221213162453.584965-4-hch@lst.de> (raw)
In-Reply-To: <20221213162453.584965-1-hch@lst.de>
Mask out the logical block change effect to allow to keep supporting
passthrough for Write commands once I/O Command effects are properly
propagated.
Fixes: c1fef73f793b ("nvmet: add passthru code to process commands")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvme/target/passthru.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c
index 79af5140af8bfe..ad80ba61c42236 100644
--- a/drivers/nvme/target/passthru.c
+++ b/drivers/nvme/target/passthru.c
@@ -295,7 +295,6 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
struct nvme_ns *ns = NULL;
struct request *rq = NULL;
unsigned int timeout;
- u32 effects;
u16 status;
int ret;
@@ -334,14 +333,16 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
}
/*
- * If there are effects for the command we are about to execute, or
- * an end_req function we need to use nvme_execute_passthru_rq()
- * synchronously in a work item seeing the end_req function and
- * nvme_passthru_end() can't be called in the request done callback
- * which is typically in interrupt context.
+ * If there are any non-trivial effects for the command we are about to
+ * execute, call nvme_execute_passthru_rq in a workqueue, so that the
+ * effects can be properly handled by the calls to nvme_passthru_start
+ * and nvme_passthru_end.
*/
- effects = nvme_command_effects(ctrl, ns, req->cmd->common.opcode);
- if (req->p.use_workqueue || effects) {
+ if (nvme_command_effects(ctrl, ns, req->cmd->common.opcode) &
+ ~NVME_CMD_EFFECTS_LBCC)
+ req->p.use_workqueue = true;
+
+ if (req->p.use_workqueue) {
INIT_WORK(&req->p.work, nvmet_passthru_execute_cmd_work);
req->p.rq = rq;
queue_work(nvmet_wq, &req->p.work);
--
2.35.1
next prev parent reply other threads:[~2022-12-13 16:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-13 16:24 only allow unprivileged passthrough for commands without effects Christoph Hellwig
2022-12-13 16:24 ` [PATCH 1/7] nvmet: use NVME_CMD_EFFECTS_CSUPP instead of open coding it Christoph Hellwig
2022-12-14 4:46 ` Chaitanya Kulkarni
2022-12-13 16:24 ` [PATCH 2/7] nvmet: set the LBCC bit for commands that modify data Christoph Hellwig
2022-12-14 4:47 ` Chaitanya Kulkarni
2022-12-13 16:24 ` Christoph Hellwig [this message]
2022-12-14 4:52 ` [PATCH 3/7] nvmet: allow async passthrough of commands that change logical block contents Chaitanya Kulkarni
2022-12-14 7:59 ` Christoph Hellwig
2022-12-13 16:24 ` [PATCH 4/7] nvme: remove nvme_execute_passthru_rq Christoph Hellwig
2022-12-14 4:54 ` Chaitanya Kulkarni
2022-12-13 16:24 ` [PATCH 5/7] nvme: only return actual effects from nvme_command_effects Christoph Hellwig
2022-12-13 16:24 ` [PATCH 6/7] nvme: also return I/O command " Christoph Hellwig
2022-12-13 17:53 ` Keith Busch
2022-12-13 18:54 ` Christoph Hellwig
2022-12-13 19:18 ` Keith Busch
2022-12-14 7:58 ` Christoph Hellwig
2022-12-13 16:24 ` [PATCH 7/7] nvme: don't allow unprivileged passthrough of commands that have effects Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221213162453.584965-4-hch@lst.de \
--to=hch@lst.de \
--cc=joshi.k@samsung.com \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox