linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: zero scsi cmd result in scsi_init_cmd_errh
@ 2010-01-26 20:57 Mike Anderson
  0 siblings, 0 replies; only message in thread
From: Mike Anderson @ 2010-01-26 20:57 UTC (permalink / raw)
  To: linux-scsi

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@linux.vnet.ibm.com>
---

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)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-26 20:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-26 20:57 [PATCH] scsi: zero scsi cmd result in scsi_init_cmd_errh Mike Anderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).