hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/nvme/target/passthru.c
....@@ -259,14 +259,13 @@
259259 }
260260
261261 /*
262
- * If there are effects for the command we are about to execute, or
263
- * an end_req function we need to use nvme_execute_passthru_rq()
264
- * synchronously in a work item seeing the end_req function and
265
- * nvme_passthru_end() can't be called in the request done callback
266
- * which is typically in interrupt context.
262
+ * If a command needs post-execution fixups, or there are any
263
+ * non-trivial effects, make sure to execute the command synchronously
264
+ * in a workqueue so that nvme_passthru_end gets called.
267265 */
268266 effects = nvme_command_effects(ctrl, ns, req->cmd->common.opcode);
269
- if (req->p.use_workqueue || effects) {
267
+ if (req->p.use_workqueue ||
268
+ (effects & ~(NVME_CMD_EFFECTS_CSUPP | NVME_CMD_EFFECTS_LBCC))) {
270269 INIT_WORK(&req->p.work, nvmet_passthru_execute_cmd_work);
271270 req->p.rq = rq;
272271 schedule_work(&req->p.work);