linux/drivers/scsi
James Bottomley 14216561e1 [SCSI] Fix 'Device not ready' issue on mpt2sas
This is a particularly nasty SCSI ATA Translation Layer (SATL) problem.

SAT-2 says (section 8.12.2)

        if the device is in the stopped state as the result of
        processing a START STOP UNIT command (see 9.11), then the SATL
        shall terminate the TEST UNIT READY command with CHECK CONDITION
        status with the sense key set to NOT READY and the additional
        sense code of LOGICAL UNIT NOT READY, INITIALIZING COMMAND
        REQUIRED;

mpt2sas internal SATL seems to implement this.  The result is very confusing
standby behaviour (using hdparm -y).  If you suspend a drive and then send
another command, usually it wakes up.  However, if the next command is a TEST
UNIT READY, the SATL sees that the drive is suspended and proceeds to follow
the SATL rules for this, returning NOT READY to all subsequent commands.  This
means that the ordering of TEST UNIT READY is crucial: if you send TUR and
then a command, you get a NOT READY to both back.  If you send a command and
then a TUR, you get GOOD status because the preceeding command woke the drive.

This bit us badly because

commit 85ef06d1d2
Author: Tejun Heo <tj@kernel.org>
Date:   Fri Jul 1 16:17:47 2011 +0200

    block: flush MEDIA_CHANGE from drivers on close(2)

Changed our ordering on TEST UNIT READY commands meaning that SATA drives
connected to an mpt2sas now suspend and refuse to wake (because the mpt2sas
SATL sees the suspend *before* the drives get awoken by the next ATA command)
resulting in lots of failed commands.

The standard is completely nuts forcing this inconsistent behaviour, but we
have to work around it.

The fix for this is twofold:

   1. Set the allow_restart flag so we wake the drive when we see it has been
      suspended

   2. Return all TEST UNIT READY status directly to the mid layer without any
      further error handling which prevents us causing error handling which
      may offline the device just because of a media check TUR.

Reported-by: Matthias Prager <linux@matthiasprager.de>
Cc: stable@vger.kernel.org
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-08-22 09:42:54 +04:00
..
aacraid [SCSI] aacraid: Series 7 Async. (performance) mode support 2012-07-20 08:59:04 +01:00
aic7xxx Documentation: remove references to /etc/modprobe.conf 2012-03-30 16:03:15 -07:00
aic7xxx_old
aic94xx [SCSI] libsas: fix taskfile corruption in sas_ata_qc_fill_rtf 2012-07-08 09:49:14 +01:00
arcmsr [SCSI] arcmsr: fix misuse of | instead of & 2012-07-20 08:58:31 +01:00
arm Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
be2iscsi [SCSI] be2iscsi: fix dma free size mismatch regression 2012-05-30 13:34:22 +04:00
bfa [SCSI] bfa: Fix to set correct return error codes and misc cleanup. 2012-07-20 08:59:05 +01:00
bnx2fc SCSI misc on 20120724 2012-07-24 18:11:22 -07:00
bnx2i Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2012-07-19 11:17:30 -07:00
cxgbi SCSI misc on 20120724 2012-07-24 18:11:22 -07:00
device_handler [SCSI] scsi_dh: add scsi_dh_attached_handler_name 2012-07-20 08:58:42 +01:00
dpt atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
fcoe [SCSI] fcoe: Cleanup locking on fcoe_percpu_receive_thread 2012-07-20 08:58:55 +01:00
fnic
ibmvscsi powerpc+sparc/vio: Modernize driver registration 2012-03-28 11:33:24 +11:00
isci [SCSI] isci: use sas eh strategy handlers 2012-07-20 08:58:51 +01:00
libfc [SCSI] libfc: fix sending REC after FCP_RESP is received 2012-07-20 08:58:56 +01:00
libsas [SCSI] async: introduce 'async_domain' type 2012-07-20 09:05:54 +01:00
lpfc [SCSI] lpfc: fix problems with -Werror 2012-07-20 08:58:54 +01:00
megaraid [SCSI] megaraid_sas: Move poll_aen_lock initializer 2012-08-22 09:39:25 +04:00
mpt2sas [SCSI] mpt2sas: Fix for Driver oops, when loading driver with max_queue_depth command line option to a very small value 2012-08-22 09:38:49 +04:00
mvsas [SCSI] mvsas: remove unused variable in mvs_task_exec() 2012-07-20 08:58:54 +01:00
osd [SCSI] osd_uld: Bump MAX_OSD_DEVICES from 64 to 1,048,576 2012-02-25 08:25:09 -06:00
pcmcia module_param: make bool parameters really bool (drivers & misc) 2012-01-13 09:32:20 +10:30
pm8001 [SCSI] libsas: trim sas_task of slow path infrastructure 2012-07-20 08:58:54 +01:00
qla2xxx SCSI misc on 20120724 2012-07-24 18:11:22 -07:00
qla4xxx [SCSI] qla4xxx: remove unnecessary read of PCI_CAP_ID_EXP 2012-07-20 08:59:02 +01:00
sym53c8xx_2 [SCSI] sym53c8xx: Fix NULL pointer dereference in slave_destroy 2012-01-10 17:01:18 -06:00
ufs [SCSI] ufs: fix incorrect return value about SUCCESS and FAILED 2012-07-20 08:59:02 +01:00
.gitignore
3w-9xxx.c [SCSI] 3w-9xxx: fix iommu_iova leak 2011-09-26 09:28:58 -05:00
3w-9xxx.h
3w-sas.c
3w-sas.h
3w-xxxx.c
3w-xxxx.h
53c700_d.h_shipped
53c700.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
53c700.h
53c700.scr
a100u2w.c
a100u2w.h
a2091.c scsi: Fix up files implicitly depending on module.h inclusion 2011-10-31 19:31:24 -04:00
a2091.h
a3000.c scsi: Fix up files implicitly depending on module.h inclusion 2011-10-31 19:31:24 -04:00
a3000.h
a4000t.c
advansys.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
aha152x.c scsi: aha152x: Fix sparse warning and make printing pointer address more portable. 2012-07-20 10:19:25 +02:00
aha152x.h
aha1542.c treewide: Put a space between #include and FILE 2012-06-28 11:44:36 +02:00
aha1542.h
aha1740.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
aha1740.h
aic7xxx_old.c
atari_NCR5380.c
atari_scsi.c scsi/atari: Make more functions static 2012-04-22 20:16:49 +02:00
atari_scsi.h scsi/atari: Make more functions static 2012-04-22 20:16:49 +02:00
atp870u.c SCSI updates on 20120331 2012-03-31 13:31:23 -07:00
atp870u.h
BusLogic.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
BusLogic.h
bvme6000_scsi.c
ch.c
constants.c
dc395x.c module_param: make bool parameters really bool (drivers & misc) 2012-01-13 09:32:20 +10:30
dc395x.h
dmx3191d.c
dpt_i2o.c
dpti.h
dtc.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
dtc.h
eata_generic.h
eata_pio.c
eata_pio.h
eata.c
esp_scsi.c scsi: Use vsprintf extention %pf with builtin_return_address 2012-04-05 17:09:40 -07:00
esp_scsi.h
fdomain.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
fdomain.h
FlashPoint.c
g_NCR5380_mmio.c
g_NCR5380.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
g_NCR5380.h
gdth_ioctl.h
gdth_proc.c
gdth_proc.h
gdth.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
gdth.h treewide: Fix comment and string typo 'bufer' 2011-12-06 09:53:40 +01:00
gvp11.c scsi: Fix up files implicitly depending on module.h inclusion 2011-10-31 19:31:24 -04:00
gvp11.h
hosts.c [SCSI] Fix device removal NULL pointer dereference 2012-07-20 08:58:40 +01:00
hpsa_cmd.h [SCSI] hpsa: dial down lockup detection during firmware flash 2012-05-10 09:19:39 +01:00
hpsa.c [SCSI] hpsa: dial down lockup detection during firmware flash 2012-05-10 09:19:39 +01:00
hpsa.h [SCSI] hpsa: dial down lockup detection during firmware flash 2012-05-10 09:19:39 +01:00
hptiop.c [SCSI] hptiop: fix RR312x in hosts with >12GB 2012-07-20 08:58:30 +01:00
hptiop.h [SCSI] hptiop: fix RR312x in hosts with >12GB 2012-07-20 08:58:30 +01:00
imm.c
imm.h
in2000.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
in2000.h
initio.c
initio.h
ipr.c [SCSI] libsas, libata: fix start of life for a sas ata_port 2012-04-23 12:11:47 +01:00
ipr.h [SCSI] ipr: Driver version 2.5.3 2012-03-28 15:09:28 +01:00
ips.c scsi: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:19 +08:00
ips.h
iscsi_boot_sysfs.c switch ->is_visible() to returning umode_t 2012-01-03 22:54:55 -05:00
iscsi_tcp.c sock: Introduce named constants for sk_reuse 2012-04-21 15:52:25 -04:00
iscsi_tcp.h
jazz_esp.c misc latin1 to utf8 conversions 2012-01-02 13:04:55 +01:00
Kconfig [SCSI] aha152x: Allow use on 64bit systems 2012-07-20 08:59:04 +01:00
lasi700.c
libiscsi_tcp.c SCSI updates on 20120319 2012-03-22 12:55:29 -07:00
libiscsi.c [SCSI] libiscsi: fix cmd timeout/completion race 2012-02-19 08:09:00 -06:00
libsrp.c scsi: Fix up files implicitly depending on module.h inclusion 2011-10-31 19:31:24 -04:00
mac53c94.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
mac53c94.h
mac_esp.c mac_esp: rename irq 2012-01-22 14:50:03 +01:00
mac_scsi.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
mac_scsi.h
Makefile [SCSI] Remove scsi_wait_scan module 2012-07-20 08:58:13 +01:00
megaraid.c [SCSI] megaraid: cleanup type issue in mega_build_cmd() 2012-07-20 08:58:38 +01:00
megaraid.h
mesh.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
mesh.h
mvme16x_scsi.c
mvme147.c
mvme147.h
mvumi.c [SCSI] mvumi: Add Marvell UMI driver 2011-08-27 08:36:58 -06:00
mvumi.h [SCSI] mvumi: Add Marvell UMI driver 2011-08-27 08:36:58 -06:00
ncr53c8xx.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
ncr53c8xx.h
NCR53c406a.c
NCR5380.c
NCR5380.h
NCR_D700.c
NCR_D700.h
NCR_Q720.c
NCR_Q720.h
nsp32_debug.c
nsp32_io.h
nsp32.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
nsp32.h
osst_detect.h
osst_options.h
osst.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
osst.h
pas16.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
pas16.h
pmcraid.c SCSI, pmcraid: Fix spelling error in a pmcraid_err() call 2011-12-15 16:35:38 +01:00
pmcraid.h scsi: Fix typo in pmcraid.h 2012-02-21 11:40:37 +01:00
ppa.c
ppa.h
ps3rom.c scsi: Fix up files implicitly depending on module.h inclusion 2011-10-31 19:31:24 -04:00
qla1280.c qla1280: Remove redundant NULL check before release_firmware() call 2012-04-30 13:25:43 +02:00
qla1280.h
qlogicfas408.c
qlogicfas408.h
qlogicfas.c
qlogicpti.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
qlogicpti.h
raid_class.c
script_asm.pl
scsi_debug.c SCSI updates on 20120331 2012-03-31 13:31:23 -07:00
scsi_devinfo.c
scsi_error.c [SCSI] Fix 'Device not ready' issue on mpt2sas 2012-08-22 09:42:54 +04:00
scsi_ioctl.c
scsi_lib_dma.c scsi: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required 2011-10-31 19:31:23 -04:00
scsi_lib.c [SCSI] scsi_lib: fix scsi_io_completion's SG_IO error propagation 2012-08-22 09:42:31 +04:00
scsi_logging.h
scsi_module.c
scsi_netlink.c netlink: add netlink_kernel_cfg parameter to netlink_kernel_create 2012-06-29 16:46:02 -07:00
scsi_pm.c [SCSI] scsi_pm: set device runtime state before parent suspended 2012-07-20 08:58:55 +01:00
scsi_priv.h [SCSI] async: introduce 'async_domain' type 2012-07-20 09:05:54 +01:00
scsi_proc.c
scsi_sas_internal.h
scsi_scan.c [SCSI] Fix 'Device not ready' issue on mpt2sas 2012-08-22 09:42:54 +04:00
scsi_sysctl.c
scsi_sysfs.c [SCSI] fix hot unplug vs async scan race 2012-07-20 08:58:45 +01:00
scsi_tgt_if.c scsi: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required 2011-10-31 19:31:23 -04:00
scsi_tgt_lib.c
scsi_tgt_priv.h
scsi_trace.c
scsi_transport_api.h
scsi_transport_fc_internal.h
scsi_transport_fc.c Merge branch 'for-3.6/core' of git://git.kernel.dk/linux-block 2012-08-01 09:02:41 -07:00
scsi_transport_iscsi.c Merge branch 'for-3.6/core' of git://git.kernel.dk/linux-block 2012-08-01 09:02:41 -07:00
scsi_transport_sas.c [SCSI] scsi_transport_sas: 'enable' phys on reset 2012-02-29 15:43:54 -06:00
scsi_transport_spi.c [SCSI] scsi_transport_spi: fix for unbalanced reference counting 2012-05-10 09:06:12 +01:00
scsi_transport_srp_internal.h
scsi_transport_srp.c
scsi_typedefs.h
scsi.c [SCSI] async: make async_synchronize_full() flush all work regardless of domain 2012-07-20 09:07:37 +01:00
scsi.h
scsicam.c fs: move code out of buffer.c 2012-01-03 22:54:07 -05:00
sd_dif.c scsi: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:19 +08:00
sd.c [SCSI] set to WCE if usb cache quirk is present. 2012-07-20 08:59:00 +01:00
sd.h [SCSI] Handle disk devices which can not process medium access commands 2012-02-19 10:14:52 -06:00
ses.c
sg.c [SCSI] sg: constify sg_proc_leaf_arr 2012-05-17 10:08:57 +01:00
sgiwd93.c
sim710.c scsi: delete the MCA specific drivers and driver code 2012-05-17 19:03:54 -04:00
sni_53c710.c misc latin1 to utf8 conversions 2012-01-02 13:04:55 +01:00
sr_ioctl.c scsi: Fix up files implicitly depending on module.h inclusion 2011-10-31 19:31:24 -04:00
sr_vendor.c
sr.c [SCSI] sr: check_events() ignore GET_EVENT when TUR says otherwise 2011-07-21 14:15:58 -07:00
sr.h [SCSI] sr: check_events() ignore GET_EVENT when TUR says otherwise 2011-07-21 14:15:58 -07:00
st_options.h
st.c SCSI updates on 20120331 2012-03-31 13:31:23 -07:00
st.h [SCSI] st: fix memory leak with >1MB tape I/O 2012-05-10 08:32:34 +01:00
stex.c
storvsc_drv.c [SCSI] storvsc: Properly handle errors from the host 2012-04-25 09:51:43 +01:00
sun3_NCR5380.c
sun3_scsi_vme.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
sun3_scsi.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
sun3_scsi.h
sun3x_esp.c
sun_esp.c
sym53c416.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
sym53c416.h
t128.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
t128.h
tmscsim.c
tmscsim.h
u14-34f.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
ultrastor.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
ultrastor.h
virtio_scsi.c [SCSI] virtio-scsi: Add vdrv->scan for post VIRTIO_CONFIG_S_DRIVER_OK LUN scanning 2012-07-20 08:59:03 +01:00
vmw_pvscsi.c [SCSI] vmw_pvscsi: Try setting host->max_id as suggested by the device. 2012-03-27 08:26:36 +01:00
vmw_pvscsi.h [SCSI] vmw_pvscsi: Try setting host->max_id as suggested by the device. 2012-03-27 08:26:36 +01:00
wd33c93.c
wd33c93.h
wd7000.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
zalon.c
zorro7xx.c