* [PATCH] libsas: check dev->gone before submitting sata i/o
@ 2011-03-17 0:55 Dan Williams
0 siblings, 0 replies; only message in thread
From: Dan Williams @ 2011-03-17 0:55 UTC (permalink / raw)
To: james.bottomley
Cc: dave.jiang, linux-scsi, jeffrey.d.skirvin, jacek.danecki,
linux-ide, dmilburn, edmund.nadolski
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.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
This is neither critical, nor complete (i/o can still sneak in after the
check), but it makes device removal cleaner in the nominal case (sync cache
commands triggered by scsi_target removal never enter ata_sas_queuecmd()).
However, with the pending/more critical "libsas: fix/amend device gone
notification in sas_deform_port()" we could go all the way and make it
impossible to submit i/o to a sata device that libsas has marked as
gone, and delete the gone check that happens in sas_ata_qc_issue(). But,
that is encoding more libsas/libata host_lock assumptions...
--
Dan
[1]: http://marc.info/?l=linux-scsi&m=129791105419577&w=2
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 1787bd2..ce3efff 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -218,6 +218,13 @@ int sas_queuecommand(struct scsi_cmnd *cmd,
struct sas_ha_struct *sas_ha = dev->port->ha;
struct sas_task *task;
+ /* If the device fell off, no sense in issuing commands */
+ if (dev->gone) {
+ cmd->result = DID_BAD_TARGET << 16;
+ scsi_done(cmd);
+ goto out;
+ }
+
if (dev_is_sata(dev)) {
unsigned long flags;
@@ -228,13 +235,6 @@ int sas_queuecommand(struct scsi_cmnd *cmd,
goto out;
}
- /* If the device fell off, no sense in issuing commands */
- if (dev->gone) {
- cmd->result = DID_BAD_TARGET << 16;
- scsi_done(cmd);
- goto out;
- }
-
res = -ENOMEM;
task = sas_create_task(cmd, dev, GFP_ATOMIC);
if (!task)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-03-17 0:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-17 0:55 [PATCH] libsas: check dev->gone before submitting sata i/o Dan Williams
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).