mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
SCSI & usb-storage: add try_rc_10_first flag
Several bug reports have been received recently for USB mass-storage
devices that don't handle READ CAPACITY(16) commands properly. They
report bogus sizes, in some cases becoming unusable as a result.
The bugs were triggered by commit
09b6b51b0b (SCSI & usb-storage: add
flags for VPD pages and REPORT LUNS), which caused usb-storage to stop
overriding the SCSI level reported by devices. By default, the sd
driver will try READ CAPACITY(16) first for any device whose level is
above SCSI_SPC_2.
It seems likely that any device large enough to require the use of
READ CAPACITY(16) (i.e., 2 TB or more) would be able to handle READ
CAPACITY(10) commands properly. Indeed, I don't know of any devices
that don't handle READ CAPACITY(10) properly.
Therefore this patch (as1559) adds a new flag telling the sd driver
to try READ CAPACITY(10) before READ CAPACITY(16), and sets this flag
for every USB mass-storage device. If a device really is larger than
2 TB, sd will fall back to READ CAPACITY(16) just as it used to.
This fixes Bugzilla #43391.
Signed-off-by: Alan Stern <[email protected]>
Acked-by: Hans de Goede <[email protected]>
CC: "James E.J. Bottomley" <[email protected]>
CC: Matthew Dharm <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
1e2c4e59d2
commit
6a0bdffa00
3 changed files with 9 additions and 0 deletions
|
|
@ -202,6 +202,12 @@ static int slave_configure(struct scsi_device *sdev)
|
|||
if (us->fflags & US_FL_NO_READ_CAPACITY_16)
|
||||
sdev->no_read_capacity_16 = 1;
|
||||
|
||||
/*
|
||||
* Many devices do not respond properly to READ_CAPACITY_16.
|
||||
* Tell the SCSI layer to try READ_CAPACITY_10 first.
|
||||
*/
|
||||
sdev->try_rc_10_first = 1;
|
||||
|
||||
/* assume SPC3 or latter devices support sense size > 18 */
|
||||
if (sdev->scsi_level > SCSI_SPC_2)
|
||||
us->fflags |= US_FL_SANE_SENSE;
|
||||
|
|
|
|||
Loading…
Reference in a new issue