]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] ipr: Fix for oops following SATA request sense
authorBrian King <brking@linux.vnet.ibm.com>
Thu, 29 Mar 2007 17:43:17 +0000 (12:43 -0500)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Sun, 1 Apr 2007 16:17:22 +0000 (11:17 -0500)
This patch fixes a problem discovered on a system with some
bad SATA devices attached. If a command to a SATAPI device
times out and the device gets reset as part of error recovery,
its possible that ipr will set err_mask to indicate a device
error has occurred. If this happens, a request sense will get
issued by libata. Since scsi core thinks this scsi command is
now completed, because the device reset handler completed successfully,
scsi core will free the associated scsi command, which may
cause an oops when that request sense is completed later
by ipr. This patch ensures that any commands that get aborted
as a result of a device reset set err_mask appropriately so
that the request sense does not get sent.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/ipr.c

index 44ce9f5218a8c70a8e1f5326e372cdba632374a3..fc1171c7def40aafc1cb5bd3c1499bb6a52318b2 100644 (file)
@@ -3846,6 +3846,8 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd * scsi_cmd)
                if (ipr_cmd->ioarcb.res_handle == res->cfgte.res_handle) {
                        if (ipr_cmd->scsi_cmd)
                                ipr_cmd->done = ipr_scsi_eh_done;
+                       if (ipr_cmd->qc)
+                               ipr_cmd->done = ipr_sata_eh_done;
                        if (ipr_cmd->qc && !(ipr_cmd->qc->flags & ATA_QCFLAG_FAILED)) {
                                ipr_cmd->qc->err_mask |= AC_ERR_TIMEOUT;
                                ipr_cmd->qc->flags |= ATA_QCFLAG_FAILED;