Skip to content

Commit 8e228ac

Browse files
Christoph Hellwiggregkh
authored andcommitted
nvmet: don't defer passthrough commands with trivial effects to the workqueue
[ Upstream commit 2a459f6 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent f068a73 commit 8e228ac

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
@@ -271,14 +271,13 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
271271
}
272272

273273
/*
274-
* If there are effects for the command we are about to execute, or
275-
* an end_req function we need to use nvme_execute_passthru_rq()
276-
* synchronously in a work item seeing the end_req function and
277-
* nvme_passthru_end() can't be called in the request done callback
278-
* which is typically in interrupt context.
274+
* If a command needs post-execution fixups, or there are any
275+
* non-trivial effects, make sure to execute the command synchronously
276+
* in a workqueue so that nvme_passthru_end gets called.
279277
*/
280278
effects = nvme_command_effects(ctrl, ns, req->cmd->common.opcode);
281-
if (req->p.use_workqueue || effects) {
279+
if (req->p.use_workqueue ||
280+
(effects & ~(NVME_CMD_EFFECTS_CSUPP | NVME_CMD_EFFECTS_LBCC))) {
282281
INIT_WORK(&req->p.work, nvmet_passthru_execute_cmd_work);
283282
req->p.rq = rq;
284283
queue_work(nvmet_wq, &req->p.work);

0 commit comments

Comments
 (0)