linux-stable/drivers/scsi
Kevin Barnett 2ba55c9851 scsi: smartpqi: correct lun reset issues
Problem:
The Linux kernel takes a logical volume offline after a LUN reset.  This is
generally accompanied by this message in the dmesg output:

Device offlined - not ready after error recovery

Root Cause:
The root cause is a "quirk" in the timeout handling in the Linux SCSI
layer. The Linux kernel places a 30-second timeout on most media access
commands (reads and writes) that it send to device drivers.  When a media
access command times out, the Linux kernel goes into error recovery mode
for the LUN that was the target of the command that timed out. Every
command that timed out is kept on a list inside of the Linux kernel to be
retried later. The kernel attempts to recover the command(s) that timed out
by issuing a LUN reset followed by a TEST UNIT READY. If the LUN reset and
TEST UNIT READY commands are successful, the kernel retries the command(s)
that timed out.

Each SCSI command issued by the kernel has a result field associated with
it. This field indicates the final result of the command (success or
error). When a command times out, the kernel places a value in this result
field indicating that the command timed out.

The "quirk" is that after the LUN reset and TEST UNIT READY commands are
completed, the kernel checks each command on the timed-out command list
before retrying it. If the result field is still "timed out", the kernel
treats that command as not having been successfully recovered for a
retry. If the number of commands that are in this state are greater than
two, the kernel takes the LUN offline.

Fix:
When our RAIDStack receives a LUN reset, it simply waits until all
outstanding commands complete. Generally, all of these outstanding commands
complete successfully. Therefore, the fix in the smartpqi driver is to
always set the command result field to indicate success when a request
completes successfully. This normally isn’t necessary because the result
field is always initialized to success when the command is submitted to the
driver. So when the command completes successfully, the result field is
left untouched. But in this case, the kernel changes the result field
behind the driver’s back and then expects the field to be changed by the
driver as the commands that timed-out complete.

Reviewed-by: Dave Carroll <david.carroll@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-12-19 22:23:35 -05:00
..
aacraid scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
aic7xxx scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
aic94xx scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
arcmsr scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
arm scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
be2iscsi scsi: introduce a max_segment_size host_template parameters 2018-12-18 23:13:12 -05:00
bfa scsi: bfa: clean up a couple of indentation issues 2018-12-19 21:54:58 -05:00
bnx2fc scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
bnx2i scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
csiostor scsi: csiostor: fix incorrect dma device in case of vport 2018-12-19 21:45:04 -05:00
cxgbi scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
cxlflash scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
device_handler Merge branch 'fixes' into misc 2018-04-03 17:38:39 -07:00
dpt
esas2r scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
fcoe scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
fnic scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
hisi_sas scsi: hisi_sas: Add support for DIF feature for v2 hw 2018-12-18 23:35:02 -05:00
ibmvscsi scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
ibmvscsi_tgt scsi: target: replace fabric_ops.name with fabric_alias 2018-11-28 18:50:59 -05:00
isci scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
libfc scsi: libfc: fc_rport: Mark expected switch fall-through 2018-11-28 21:47:30 -05:00
libsas scsi: libsas: Remove pcidev reference 2018-11-15 14:37:06 -05:00
lpfc scsi: lpfc: Update lpfc version to 12.0.0.10 2018-12-19 22:13:08 -05:00
megaraid scsi: megaraid_sas: driver version update 2018-12-19 21:41:11 -05:00
mpt3sas scsi: mpt3sas: fix memory ordering on 64bit writes 2018-12-19 21:31:41 -05:00
mvsas scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
osd scsi: osd: initiator should use mq variant of request ending 2018-10-16 17:48:35 -04:00
pcmcia scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
pm8001 scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
qedf scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
qedi scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
qla2xxx scsi: qla2xxx: deadlock by configfs_depend_item 2018-12-19 21:26:38 -05:00
qla4xxx scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
smartpqi scsi: smartpqi: correct lun reset issues 2018-12-19 22:23:35 -05:00
snic scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
sym53c8xx_2 scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
ufs scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
.gitignore
3w-9xxx.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
3w-9xxx.h scsi: 3w-9xxx: rework lock timeouts 2017-12-04 20:32:53 -05:00
3w-sas.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
3w-sas.h
3w-xxxx.c scsi: 3w-xxxx: fix indentation issue, add missing tab 2018-12-19 21:54:07 -05:00
3w-xxxx.h scsi: 3w-xxx: fully convert to the generic DMA API 2018-10-17 21:58:51 -04:00
53c700.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
53c700.h scsi: 53c700: Fix spelling of 'NEGOTIATION' 2018-08-30 07:27:22 -04:00
53c700.scr
53c700_d.h_shipped
a100u2w.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
a100u2w.h
a2091.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
a2091.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
a3000.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
a3000.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
a4000t.c
advansys.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
aha152x.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
aha152x.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
aha1542.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
aha1542.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
aha1740.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
aha1740.h scsi: core: remove Scsi_Cmnd typedef 2018-06-19 22:02:25 -04:00
am53c974.c scsi: esp_scsi: move dma mapping into the core code 2018-10-15 23:00:38 -04:00
atari_scsi.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
atp870u.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
atp870u.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
BusLogic.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
BusLogic.h
bvme6000_scsi.c
ch.c scsi: core: check for equality of result byte values 2018-06-26 12:27:06 -04:00
constants.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dc395x.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
dc395x.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dmx3191d.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
dpt_i2o.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
dpti.h scsi: dpt_i2o: stop using scsi_unregister 2018-03-15 00:25:37 -04:00
esp_scsi.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
esp_scsi.h scsi: esp_scsi: De-duplicate PIO routines 2018-10-17 21:38:20 -04:00
FlashPoint.c scsi: FlashPoint: Remove unnecessary parentheses 2018-09-25 20:45:53 -04:00
g_NCR5380.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
gdth.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
gdth.h scsi: core: remove Scsi_Cmnd typedef 2018-06-19 22:02:25 -04:00
gdth_ioctl.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gdth_proc.c scsi: core: remove Scsi_Cmnd typedef 2018-06-19 22:02:25 -04:00
gdth_proc.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gvp11.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
gvp11.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hosts.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
hpsa.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
hpsa.h scsi: hpsa: correct enclosure sas address 2018-07-10 22:25:03 -04:00
hpsa_cmd.h
hptiop.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
hptiop.h
imm.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
imm.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
initio.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
initio.h
ipr.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
ipr.h scsi: ipr: System hung while dlpar adding primary ipr adapter back 2018-09-21 12:35:39 -04:00
ips.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
ips.h scsi: ips: properly handle 64-bit DMA 2018-11-06 21:31:28 -05:00
iscsi_boot_sysfs.c
iscsi_tcp.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
iscsi_tcp.h
jazz_esp.c scsi: esp_scsi: move dma mapping into the core code 2018-10-15 23:00:38 -04:00
Kconfig powerpc: remove CONFIG_MCA leftovers 2018-11-02 00:15:24 +09:00
lasi700.c
libiscsi.c SCSI misc on 20180815 2018-08-15 22:06:26 -07:00
libiscsi_tcp.c scsi: core: remove Scsi_Cmnd typedef 2018-06-19 22:02:25 -04:00
mac53c94.c scsi: mac53c94: remove DISABLE_CLUSTERING 2018-12-18 23:13:12 -05:00
mac53c94.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mac_esp.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
mac_scsi.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
Makefile scsi: myrs: Add Mylex RAID controller (SCSI interface) 2018-10-17 21:07:54 -04:00
megaraid.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
megaraid.h scsi: core: remove Scsi_Cmnd typedef 2018-06-19 22:02:25 -04:00
mesh.c scsi: mesh: remove DISABLE_CLUSTERING 2018-12-18 23:13:12 -05:00
mesh.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mvme16x_scsi.c
mvme147.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
mvme147.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mvumi.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
mvumi.h
myrb.c scsi: myrb: remove the dma_boundary limit 2018-12-19 21:43:17 -05:00
myrb.h scsi: myrb: Add Mylex RAID controller (block interface) 2018-10-17 21:06:49 -04:00
myrs.c scsi: myrs: remove the dma_boundary_limit 2018-12-19 21:43:30 -05:00
myrs.h scsi: myrs: Add Mylex RAID controller (SCSI interface) 2018-10-17 21:07:54 -04:00
ncr53c8xx.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
ncr53c8xx.h
NCR5380.c scsi: NCR5380: Check for bus reset 2018-09-28 02:22:43 -04:00
NCR5380.h scsi: NCR5380: Have NCR5380_select() return a bool 2018-09-28 02:17:51 -04:00
nsp32.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
nsp32.h
nsp32_debug.c scsi: core: remove Scsi_Cmnd typedef 2018-06-19 22:02:25 -04:00
nsp32_io.h
osst.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
osst.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
osst_detect.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
osst_options.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pmcraid.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
pmcraid.h scsi: pmcraid: Use sgl_alloc_order() and sgl_free_order() 2018-02-13 21:49:15 -05:00
ppa.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
ppa.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ps3rom.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
qla1280.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
qla1280.h
qlogicfas.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
qlogicfas408.c
qlogicfas408.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
qlogicpti.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
qlogicpti.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
raid_class.c scsi: raid_attrs: fix unused variable warning 2018-08-30 07:21:04 -04:00
script_asm.pl
scsi.c scsi: read host_busy via scsi_host_busy() 2018-06-26 12:53:26 -04:00
scsi.h scsi: core: remove Scsi_Cmnd typedef 2018-06-19 22:02:25 -04:00
scsi_common.c scsi: core: doc. fixes to scsi_common.c 2017-12-11 21:39:39 -05:00
scsi_debug.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
scsi_debugfs.c scsi: devinfo: use const_ilog2 for array indices 2018-04-20 19:14:28 -04:00
scsi_debugfs.h
scsi_devinfo.c scsi: devinfo: BLIST_RETRY_ASC_C1 for Fujitsu ETERNUS 2018-04-20 19:14:36 -04:00
scsi_dh.c scsi: scsi_dh: replace too broad "TP9" string with the exact models 2018-04-18 19:34:08 -04:00
scsi_error.c scsi: core: Remove scsi_block_when_processing_errors: message 2018-10-17 20:54:20 -04:00
scsi_ioctl.c scsi: core: check for equality of result byte values 2018-06-26 12:27:06 -04:00
scsi_lib.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
scsi_lib_dma.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
scsi_logging.c
scsi_logging.h SCSI misc on 20171114 2017-11-14 16:23:44 -08:00
scsi_netlink.c
scsi_pm.c block: Move power management code into a new source file 2018-09-26 15:11:28 -06:00
scsi_priv.h scsi: dh: Remove scsi_dh_remove_device() 2017-12-07 21:13:45 -05:00
scsi_proc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
scsi_sas_internal.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
scsi_scan.c scsi: core: check for equality of result byte values 2018-06-26 12:27:06 -04:00
scsi_sysctl.c
scsi_sysfs.c scsi: core: Avoid that SCSI device removal through sysfs triggers a deadlock 2018-08-02 15:53:36 -04:00
scsi_trace.c
scsi_transport_api.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
scsi_transport_fc.c SCSI misc on 20180815 2018-08-15 22:06:26 -07:00
scsi_transport_iscsi.c block: remove parent device reference from struct bsg_class_device 2018-05-29 13:00:25 -06:00
scsi_transport_sas.c scsi: libsas: delete dead code in scsi_transport_sas.c 2018-09-25 21:20:23 -04:00
scsi_transport_spi.c scsi: core: check for equality of result byte values 2018-06-26 12:27:06 -04:00
scsi_transport_srp.c for-4.18/block-20180603 2018-06-04 07:58:06 -07:00
scsicam.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sd.c block: Introduce blk_revalidate_disk_zones() 2018-10-25 11:17:40 -06:00
sd.h block: Introduce blk_revalidate_disk_zones() 2018-10-25 11:17:40 -06:00
sd_dif.c block: move dif_prepare/dif_complete functions to block layer 2018-07-30 08:27:02 -06:00
sd_zbc.c block: Introduce blk_revalidate_disk_zones() 2018-10-25 11:17:40 -06:00
sense_codes.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ses.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
sg.c scsi: sg: remove bad blk_end_request_all() call 2018-10-16 17:49:57 -04:00
sgiwd93.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
sim710.c
sni_53c710.c
sr.c block: genhd: add 'groups' argument to device_add_disk 2018-09-28 08:30:28 -06:00
sr.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sr_ioctl.c block: Switch struct packet_command to use struct scsi_sense_hdr 2018-08-02 15:22:13 -06:00
sr_vendor.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
st.c scsi: st: remove redundant pointer STbuffer 2018-08-08 21:15:54 -04:00
st.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
st_options.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stex.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
storvsc_drv.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
sun3_scsi.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
sun3_scsi_vme.c
sun3x_esp.c scsi: esp_scsi: move dma mapping into the core code 2018-10-15 23:00:38 -04:00
sun_esp.c scsi: sun_esp: Use of_node_name_eq for node name comparisons 2018-12-07 21:56:06 -05:00
virtio_scsi.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
vmw_pvscsi.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
vmw_pvscsi.h
wd33c93.c
wd33c93.h
wd719x.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
wd719x.h scsi: wd719x: use per-command private data 2018-11-15 14:27:08 -05:00
xen-scsifront.c scsi: xen-scsifront: remove DISABLE_CLUSTERING 2018-12-18 23:13:12 -05:00
zalon.c
zorro7xx.c
zorro_esp.c scsi: esp_scsi: De-duplicate PIO routines 2018-10-17 21:38:20 -04:00