Skip to content

Commit 54bebe4

Browse files
nastya-nizharadzemartinkpetersen
authored andcommitted
scsi: core: Clear flags for scsi_cmnd that did not complete
Commands that have not been completed with scsi_done() do not clear the SCMD_INITIALIZED flag and therefore will not be properly reinitialized. Thus, the next time the scsi_cmnd structure is used, the command may fail in scsi_cmd_runtime_exceeded() due to the old jiffies_at_alloc value: kernel: sd 16:0:1:84: [sdts] tag#405 timing out command, waited 720s kernel: sd 16:0:1:84: [sdts] tag#405 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=66636s Clear flags for commands that have not been completed by SCSI. Fixes: 4abafdc ("block: remove the initialize_rq_fn blk_mq_ops method") Signed-off-by: Anastasia Kovaleva <a.kovaleva@yadro.com> Link: https://lore.kernel.org/r/20250324084933.15932-2-a.kovaleva@yadro.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 569330a commit 54bebe4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/scsi/scsi_lib.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,8 +1253,12 @@ EXPORT_SYMBOL_GPL(scsi_alloc_request);
12531253
*/
12541254
static void scsi_cleanup_rq(struct request *rq)
12551255
{
1256+
struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(rq);
1257+
1258+
cmd->flags = 0;
1259+
12561260
if (rq->rq_flags & RQF_DONTPREP) {
1257-
scsi_mq_uninit_cmd(blk_mq_rq_to_pdu(rq));
1261+
scsi_mq_uninit_cmd(cmd);
12581262
rq->rq_flags &= ~RQF_DONTPREP;
12591263
}
12601264
}

0 commit comments

Comments
 (0)