Skip to content

Commit 1363074

Browse files
jwrdegoedegregkh
authored andcommitted
USB: uas: Add a new NO_REPORT_LUNS quirk
Add a new NO_REPORT_LUNS quirk and set it for Seagate drives with an usb-id of: 0bc2:331a, as these will fail to respond to a REPORT_LUNS command. Cc: stable@vger.kernel.org Reported-and-tested-by: David Webb <djw@noc.ac.uk> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 198de51 commit 1363074

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-2
lines changed

Documentation/kernel-parameters.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4077,6 +4077,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
40774077
sector if the number is odd);
40784078
i = IGNORE_DEVICE (don't bind to this
40794079
device);
4080+
j = NO_REPORT_LUNS (don't use report luns
4081+
command, uas only);
40804082
l = NOT_LOCKABLE (don't try to lock and
40814083
unlock ejectable media);
40824084
m = MAX_SECTORS_64 (don't transfer more

drivers/usb/storage/uas.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* USB Attached SCSI
33
* Note that this is not the same as the USB Mass Storage driver
44
*
5-
* Copyright Hans de Goede <hdegoede@redhat.com> for Red Hat, Inc. 2013 - 2014
5+
* Copyright Hans de Goede <hdegoede@redhat.com> for Red Hat, Inc. 2013 - 2016
66
* Copyright Matthew Wilcox for Intel Corp, 2010
77
* Copyright Sarah Sharp for Intel Corp, 2010
88
*
@@ -781,6 +781,17 @@ static int uas_eh_bus_reset_handler(struct scsi_cmnd *cmnd)
781781
return SUCCESS;
782782
}
783783

784+
static int uas_target_alloc(struct scsi_target *starget)
785+
{
786+
struct uas_dev_info *devinfo = (struct uas_dev_info *)
787+
dev_to_shost(starget->dev.parent)->hostdata;
788+
789+
if (devinfo->flags & US_FL_NO_REPORT_LUNS)
790+
starget->no_report_luns = 1;
791+
792+
return 0;
793+
}
794+
784795
static int uas_slave_alloc(struct scsi_device *sdev)
785796
{
786797
struct uas_dev_info *devinfo =
@@ -831,6 +842,7 @@ static struct scsi_host_template uas_host_template = {
831842
.module = THIS_MODULE,
832843
.name = "uas",
833844
.queuecommand = uas_queuecommand,
845+
.target_alloc = uas_target_alloc,
834846
.slave_alloc = uas_slave_alloc,
835847
.slave_configure = uas_slave_configure,
836848
.eh_abort_handler = uas_eh_abort_handler,

drivers/usb/storage/unusual_uas.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ UNUSUAL_DEV(0x0bc2, 0x3312, 0x0000, 0x9999,
6464
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
6565
US_FL_NO_ATA_1X),
6666

67+
/* Reported-by: David Webb <djw@noc.ac.uk> */
68+
UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x9999,
69+
"Seagate",
70+
"Expansion Desk",
71+
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
72+
US_FL_NO_REPORT_LUNS),
73+
6774
/* Reported-by: Hans de Goede <hdegoede@redhat.com> */
6875
UNUSUAL_DEV(0x0bc2, 0x3320, 0x0000, 0x9999,
6976
"Seagate",

drivers/usb/storage/usb.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags)
482482
US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 |
483483
US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE |
484484
US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES |
485-
US_FL_MAX_SECTORS_240);
485+
US_FL_MAX_SECTORS_240 | US_FL_NO_REPORT_LUNS);
486486

487487
p = quirks;
488488
while (*p) {
@@ -532,6 +532,9 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags)
532532
case 'i':
533533
f |= US_FL_IGNORE_DEVICE;
534534
break;
535+
case 'j':
536+
f |= US_FL_NO_REPORT_LUNS;
537+
break;
535538
case 'l':
536539
f |= US_FL_NOT_LOCKABLE;
537540
break;

include/linux/usb_usual.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@
7979
/* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \
8080
US_FLAG(MAX_SECTORS_240, 0x08000000) \
8181
/* Sets max_sectors to 240 */ \
82+
US_FLAG(NO_REPORT_LUNS, 0x10000000) \
83+
/* Cannot handle REPORT_LUNS */ \
8284

8385
#define US_FLAG(name, value) US_FL_##name = value ,
8486
enum { US_DO_ALL_FLAGS };

0 commit comments

Comments
 (0)