Skip to content

Commit 2a459f6

Browse files
author
Christoph Hellwig
committed
nvmet: don't defer passthrough commands with trivial effects to the workqueue
Mask out the "Command Supported" and "Logical Block Content Change" bits and only defer execution of commands that have non-trivial effects to the workqueue for synchronous execution. This allows to execute admin commands asynchronously on controllers that provide a Command Supported and Effects log page, and will keep allowing to execute Write commands asynchronously once command effects on I/O commands are taken into account. Fixes: c1fef73 ("nvmet: add passthru code to process commands") Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Keith Busch <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Kanchan Joshi <[email protected]>
1 parent f2d1421 commit 2a459f6

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/nvme/target/passthru.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,14 +334,13 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
334334
}
335335

336336
/*
337-
* If there are effects for the command we are about to execute, or
338-
* an end_req function we need to use nvme_execute_passthru_rq()
339-
* synchronously in a work item seeing the end_req function and
340-
* nvme_passthru_end() can't be called in the request done callback
341-
* which is typically in interrupt context.
337+
* If a command needs post-execution fixups, or there are any
338+
* non-trivial effects, make sure to execute the command synchronously
339+
* in a workqueue so that nvme_passthru_end gets called.
342340
*/
343341
effects = nvme_command_effects(ctrl, ns, req->cmd->common.opcode);
344-
if (req->p.use_workqueue || effects) {
342+
if (req->p.use_workqueue ||
343+
(effects & ~(NVME_CMD_EFFECTS_CSUPP | NVME_CMD_EFFECTS_LBCC))) {
345344
INIT_WORK(&req->p.work, nvmet_passthru_execute_cmd_work);
346345
req->p.rq = rq;
347346
queue_work(nvmet_wq, &req->p.work);

0 commit comments

Comments
 (0)