This patch zeros the command result in scsi_init_cmd_errh to ensure that the scsi command result is zero prior to starting the command as the command could have previously had a non-zero result if the command has been requeued. In a timeout case that exhausts retries this previous non-zero result value can lead to incorrect final status not being set to timeout in scsi_eh_flush_done_q which may lead to incorrect status being conveyed to command originator or others viewing the result field. Signed-off-by: Mike Anderson <andmike@xxxxxxxxxxxxxxxxxx> --- Debug: Added a debug flag to track result being dirty (DRIVER_RES_DIRTY). Set and checked for dirty flag already set in scsi_queue_insert. On timeout case received: kernel: [42236.341626] scsi_queue_insert: Cmd ffff8800379ab080, result dirty 9 drivers/scsi/scsi_lib.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index d892768..25e5a6c 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -295,6 +295,7 @@ static void scsi_init_cmd_errh(struct scsi_cmnd *cmd) memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); if (cmd->cmd_len == 0) cmd->cmd_len = scsi_command_size(cmd->cmnd); + cmd->result = 0; } void scsi_device_unbusy(struct scsi_device *sdev) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html