]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: core: Clear flags for scsi_cmnd that did not complete
authorAnastasia Kovaleva <a.kovaleva@yadro.com>
Mon, 24 Mar 2025 08:49:33 +0000 (11:49 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 05:50:43 +0000 (07:50 +0200)
commit4d6919dd7c69fe7591a0006d5527d6861f79c8de
tree76d5ec487e8850c74877775ea7c81250b926b9d6
parent4a1b61f91078bc79f95b3a903adb8ccfa9d856d9
scsi: core: Clear flags for scsi_cmnd that did not complete

[ Upstream commit 54bebe46871d4e56e05fcf55c1a37e7efa24e0a8 ]

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: 4abafdc4360d ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/scsi_lib.c