New features are being added to the READ CAPACITY 16 results, so we want to try to issue it in preference to READ CAPACITY 10. Unfortunately, some USB devices hang when they see a READ CAPACITY 16, so we limit our chances of causing a hang by restricting this command to devices which claim conformance to SCSI-3. USB devices are currently limited to claiming at most SCSI-2 conformance. Of course, it's entirely legitimate for devices to not implement READ CAPACITY 16, so this patch also includes a fallback to READ CAPACITY 10 for SCSI-3 devices. Signed-off-by: Matthew Wilcox <willy@xxxxxxxxxxxxxxx> --- drivers/scsi/sd.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index f244349..25a923b 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1424,11 +1424,14 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer) int sector_size; struct scsi_device *sdp = sdkp->device; - /* Force READ CAPACITY(16) when PROTECT=1 */ - if (scsi_device_protection(sdp)) { + if (sdp->scsi_level > SCSI_2) { sector_size = read_capacity_16(sdkp, sdp, buffer); if (sector_size == -EOVERFLOW) goto got_data; + if (sector_size == -ENODEV) + return; + if (sector_size < 0) + sector_size = read_capacity_10(sdkp, sdp, buffer); if (sector_size < 0) return; } else { -- Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step." -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html