diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-05-24 16:17:58 -0400 |
---|---|---|
committer | James Bottomley <jbottomley@parallels.com> | 2011-05-26 23:49:33 -0400 |
commit | 3673f4bf6a277f4f2944ad153ceb167b340f9ffc (patch) | |
tree | cdf617316cffcb247c7524e430387e1f906ff987 /drivers/scsi | |
parent | 90f1e10d08bad84f8fd15d3469a60d437d4de64f (diff) |
[SCSI] libsas: check dev->gone before submitting sata i/o
Head off doomed-to-fail i/o in sas_queuecommand before sending it down
the ata path.
Before:
sd 7:0:0:0: [sdd] Synchronizing SCSI cache
ata8: no sense translation for status: 0x00
ata8: translated ATA stat/err 0x00/00 to SCSI SK/ASC/ASCQ 0xb/00/00
ata8.00: device reported invalid CHS sector 0
ata8: status=0x00 { }
ata8: no sense translation for status: 0x00
ata8: translated ATA stat/err 0x00/00 to SCSI SK/ASC/ASCQ 0xb/00/00
ata8.00: device reported invalid CHS sector 0
ata8: status=0x00 { }
ata8: no sense translation for status: 0x00
ata8: translated ATA stat/err 0x00/00 to SCSI SK/ASC/ASCQ 0xb/00/00
ata8.00: device reported invalid CHS sector 0
ata8: status=0x00 { }
sd 7:0:0:0: [sdd] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
sd 7:0:0:0: [sdd] Sense Key : Aborted Command [current] [descriptor]
sd 7:0:0:0: [sdd] Add. Sense: No additional sense information
sd 7:0:0:0: [sdd] Stopping disk
After:
sd 9:0:0:0: [sdd] Synchronizing SCSI cache
sd 9:0:0:0: [sdd] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
sd 9:0:0:0: [sdd] Stopping disk
sd 9:0:0:0: [sdd] START_STOP FAILED
sd 9:0:0:0: [sdd] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
This is a cosmetic change as sata i/o can still leak to a gone device,
but this addresses the nominal hotplug case when releasing the target.
Acked-by: Jack Wang <jack_wang@usish.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <jbottomley@parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/libsas/sas_scsi_host.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index f6e189f40917..eeba76cdf774 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c | |||
@@ -207,6 +207,13 @@ static int sas_queuecommand_lck(struct scsi_cmnd *cmd, | |||
207 | struct sas_ha_struct *sas_ha = dev->port->ha; | 207 | struct sas_ha_struct *sas_ha = dev->port->ha; |
208 | struct sas_task *task; | 208 | struct sas_task *task; |
209 | 209 | ||
210 | /* If the device fell off, no sense in issuing commands */ | ||
211 | if (dev->gone) { | ||
212 | cmd->result = DID_BAD_TARGET << 16; | ||
213 | scsi_done(cmd); | ||
214 | goto out; | ||
215 | } | ||
216 | |||
210 | if (dev_is_sata(dev)) { | 217 | if (dev_is_sata(dev)) { |
211 | unsigned long flags; | 218 | unsigned long flags; |
212 | 219 | ||
@@ -216,13 +223,6 @@ static int sas_queuecommand_lck(struct scsi_cmnd *cmd, | |||
216 | goto out; | 223 | goto out; |
217 | } | 224 | } |
218 | 225 | ||
219 | /* If the device fell off, no sense in issuing commands */ | ||
220 | if (dev->gone) { | ||
221 | cmd->result = DID_BAD_TARGET << 16; | ||
222 | scsi_done(cmd); | ||
223 | goto out; | ||
224 | } | ||
225 | |||
226 | res = -ENOMEM; | 226 | res = -ENOMEM; |
227 | task = sas_create_task(cmd, dev, GFP_ATOMIC); | 227 | task = sas_create_task(cmd, dev, GFP_ATOMIC); |
228 | if (!task) | 228 | if (!task) |