linux/drivers/usb/storage
Alan Stern 75c8542375 usb-storage: fix bogus hardware error messages for ATA pass-thru devices
[ Upstream commit a4fd4a724d ]

Ever since commit a621bac304 ("scsi_lib: correctly retry failed zero
length REQ_TYPE_FS commands"), people have been getting bogus error
messages for USB disk drives using ATA pass-thru.  For example:

[ 1344.880193] sd 6:0:0:0: [sdb] Attached SCSI disk
[ 1345.069152] sd 6:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_SENSE
[ 1345.069159] sd 6:0:0:0: [sdb] tag#0 Sense Key : Hardware Error [current] [descriptor]
[ 1345.069162] sd 6:0:0:0: [sdb] tag#0 Add. Sense: No additional sense information
[ 1345.069168] sd 6:0:0:0: [sdb] tag#0 CDB: ATA command pass through(16) 85 06 20 00 00 00 00 00 00 00 00 00 00 00 e5 00
[ 1345.172252] sd 6:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_SENSE
[ 1345.172258] sd 6:0:0:0: [sdb] tag#0 Sense Key : Hardware Error [current] [descriptor]
[ 1345.172261] sd 6:0:0:0: [sdb] tag#0 Add. Sense: No additional sense information
[ 1345.172266] sd 6:0:0:0: [sdb] tag#0 CDB: ATA command pass through(12)/Blank a1 06 20 da 00 00 4f c2 00 b0 00 00

These messages can be quite annoying, because programs like udisks2
provoke them every 10 minutes or so.  Other programs can also have
this effect, such as those in smartmontools.

I don't fully understand how that commit induced the SCSI core to log
these error messages, but the underlying cause for them is code added
to usb-storage by commit f1a0743bc0 ("USB: storage: When a device
returns no sense data, call it a Hardware Error").  At the time it was
necessary to do this, in order to prevent an infinite retry loop with
some not-so-great mass storage devices.

However, the ATA pass-thru protocol uses SCSI sense data to return
command status values, and some devices always report Check Condition
status for ATA pass-thru commands to ensure that the host retrieves
the sense data, even if the command succeeded.  This violates the USB
mass-storage protocol (Check Condition status is supposed to mean the
command failed), but we can't help that.

This patch attempts to mitigate the problem of these bogus error
reports by changing usb-storage.  The HARDWARE ERROR sense key will be
inserted only for commands that aren't ATA pass-thru.

Thanks to Ewan Milne for pointing out that this mechanism was present
in usb-storage.  8 years after writing it, I had completely forgotten
its existence.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Kris Lindgren <kris.lindgren@gmail.com>
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1351305
CC: Ewan D. Milne <emilne@redhat.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2018-11-10 07:41:37 -08:00
..
alauda.c usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
cypress_atacb.c usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
datafab.c usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
debug.c USB patches for 3.19-rc1 2014-12-14 14:57:16 -08:00
debug.h usb: storage: Convert usb_stor_dbg to return void 2014-11-03 15:38:17 -08:00
ene_ub6250.c USB: ene_usb6250: fix SCSI residue overwriting 2018-04-13 19:50:07 +02:00
freecom.c usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
initializers.c storage: Enable multi-target mode as vendor driver does for SCM eUSCSI bridge 2014-11-24 17:22:38 -08:00
initializers.h USB: storage: fix Huawei mode switching regression 2013-03-07 12:23:17 +08:00
isd200.c usb: storage: return on error to avoid a null pointer dereference 2017-07-27 15:06:05 -07:00
jumpshot.c usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
karma.c usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
Kconfig PM / Kconfig: Replace PM_RUNTIME with PM in dependencies 2014-12-13 00:44:04 +01:00
Makefile
onetouch.c usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
option_ms.c usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
option_ms.h
protocol.c USB: storage: fix compile warning 2013-12-09 23:45:39 -08:00
protocol.h
realtek_cr.c usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
scsiglue.c USB: Add quirk to support DJI CineSSD 2018-09-26 08:35:07 +02:00
scsiglue.h usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
sddr09.c usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
sddr55.c usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
shuttle_usbat.c usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
sierra_ms.c usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
sierra_ms.h
transport.c usb-storage: fix bogus hardware error messages for ATA pass-thru devices 2018-11-10 07:41:37 -08:00
transport.h
uas-detect.h uas: Always apply US_FL_NO_ATA_1X quirk to Seagate devices 2017-12-09 18:42:37 +01:00
uas.c uas: fix comparison for error code 2018-03-18 11:17:53 +01:00
unusual_alauda.h
unusual_cypress.h usb-storage: restrict bcdDevice range for Super Top in Cypress ATACB 2014-02-04 12:59:14 -08:00
unusual_datafab.h
unusual_devs.h USB: Add quirk to support DJI CineSSD 2018-09-26 08:35:07 +02:00
unusual_ene_ub6250.h
unusual_freecom.h
unusual_isd200.h
unusual_jumpshot.h
unusual_karma.h
unusual_onetouch.h
unusual_realtek.h
unusual_sddr09.h
unusual_sddr55.h
unusual_uas.h uas: ignore UAS for Norelsys NS1068(X) chips 2018-01-17 09:35:32 +01:00
unusual_usbat.h
usb.c USB: uas: Add a new NO_REPORT_LUNS quirk 2016-04-20 15:42:07 +09:00
usb.h usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
usual-tables.c