aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorUlrich Obergfell <uobergfe@redhat.com>2014-06-04 07:34:57 -0400
committerChristoph Hellwig <hch@lst.de>2014-06-24 11:00:12 -0400
commit8922a908908ff947f1f211e07e2e97f1169ad3cb (patch)
treea1e892598591ccbea088344ae55e359c0ead64c9 /drivers/scsi
parent8b8f5d9715845f9ae2b89ce406e71877965b29ca (diff)
scsi_error: fix invalid setting of host byte
After scsi_try_to_abort_cmd returns, the eh_abort_handler may have already found that the command has completed in the device, causing the host_byte to be nonzero (e.g. it could be DID_ABORT). When this happens, ORing DID_TIME_OUT into the host byte will corrupt the result field and initiate an unwanted command retry. Fix this by using set_host_byte instead, following the model of commit 2082ebc45af9c9c648383b8cde0dc1948eadbf31. Cc: stable@vger.kernel.org Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com> [Fix all instances according to review comments. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Ewan D. Milne <emilne@redhat.com> Reviewed-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/scsi_error.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index cbe38e5e7955..55ecf70fe3d9 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -131,7 +131,7 @@ scmd_eh_abort_handler(struct work_struct *work)
131 "aborting command %p\n", scmd)); 131 "aborting command %p\n", scmd));
132 rtn = scsi_try_to_abort_cmd(sdev->host->hostt, scmd); 132 rtn = scsi_try_to_abort_cmd(sdev->host->hostt, scmd);
133 if (rtn == SUCCESS) { 133 if (rtn == SUCCESS) {
134 scmd->result |= DID_TIME_OUT << 16; 134 set_host_byte(scmd, DID_TIME_OUT);
135 if (scsi_host_eh_past_deadline(sdev->host)) { 135 if (scsi_host_eh_past_deadline(sdev->host)) {
136 SCSI_LOG_ERROR_RECOVERY(3, 136 SCSI_LOG_ERROR_RECOVERY(3,
137 scmd_printk(KERN_INFO, scmd, 137 scmd_printk(KERN_INFO, scmd,
@@ -167,7 +167,7 @@ scmd_eh_abort_handler(struct work_struct *work)
167 scmd_printk(KERN_WARNING, scmd, 167 scmd_printk(KERN_WARNING, scmd,
168 "scmd %p terminate " 168 "scmd %p terminate "
169 "aborted command\n", scmd)); 169 "aborted command\n", scmd));
170 scmd->result |= DID_TIME_OUT << 16; 170 set_host_byte(scmd, DID_TIME_OUT);
171 scsi_finish_command(scmd); 171 scsi_finish_command(scmd);
172 } 172 }
173} 173}
@@ -291,7 +291,7 @@ enum blk_eh_timer_return scsi_times_out(struct request *req)
291 if (scsi_abort_command(scmd) == SUCCESS) 291 if (scsi_abort_command(scmd) == SUCCESS)
292 return BLK_EH_NOT_HANDLED; 292 return BLK_EH_NOT_HANDLED;
293 293
294 scmd->result |= DID_TIME_OUT << 16; 294 set_host_byte(scmd, DID_TIME_OUT);
295 295
296 if (unlikely(rtn == BLK_EH_NOT_HANDLED && 296 if (unlikely(rtn == BLK_EH_NOT_HANDLED &&
297 !scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD))) 297 !scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD)))
@@ -1777,7 +1777,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
1777 break; 1777 break;
1778 case DID_ABORT: 1778 case DID_ABORT:
1779 if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) { 1779 if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) {
1780 scmd->result |= DID_TIME_OUT << 16; 1780 set_host_byte(scmd, DID_TIME_OUT);
1781 return SUCCESS; 1781 return SUCCESS;
1782 } 1782 }
1783 case DID_NO_CONNECT: 1783 case DID_NO_CONNECT: