* [PATCH] uas: Add a new NO_REPORT_LUNS quirk
@ 2016-03-31 12:22 Hans de Goede
[not found] ` <1459426971-11927-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-31 14:48 ` James Bottomley
0 siblings, 2 replies; 7+ messages in thread
From: Hans de Goede @ 2016-03-31 12:22 UTC (permalink / raw)
To: Greg Kroah-Hartman, Gerd Hoffmann
Cc: David Webb, linux-usb, linux-scsi, stable, Hans de Goede
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>
---
drivers/usb/storage/uas.c | 14 +++++++++++++-
drivers/usb/storage/unusual_uas.h | 7 +++++++
drivers/usb/storage/usb.c | 5 ++++-
include/linux/usb_usual.h | 2 ++
4 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index c68e724147..5e15ed03 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -2,7 +2,7 @@
* USB Attached SCSI
* Note that this is not the same as the USB Mass Storage driver
*
- * Copyright Hans de Goede <hdegoede@redhat.com> for Red Hat, Inc. 2013 - 2014
+ * Copyright Hans de Goede <hdegoede@redhat.com> for Red Hat, Inc. 2013 - 2016
* Copyright Matthew Wilcox for Intel Corp, 2010
* Copyright Sarah Sharp for Intel Corp, 2010
*
@@ -781,6 +781,17 @@ static int uas_eh_bus_reset_handler(struct scsi_cmnd *cmnd)
return SUCCESS;
}
+static int uas_target_alloc(struct scsi_target *starget)
+{
+ struct uas_dev_info *devinfo = (struct uas_dev_info *)
+ dev_to_shost(starget->dev.parent)->hostdata;
+
+ if (devinfo->flags & US_FL_NO_REPORT_LUNS)
+ starget->no_report_luns = 1;
+
+ return 0;
+}
+
static int uas_slave_alloc(struct scsi_device *sdev)
{
struct uas_dev_info *devinfo =
@@ -831,6 +842,7 @@ static struct scsi_host_template uas_host_template = {
.module = THIS_MODULE,
.name = "uas",
.queuecommand = uas_queuecommand,
+ .target_alloc = uas_target_alloc,
.slave_alloc = uas_slave_alloc,
.slave_configure = uas_slave_configure,
.eh_abort_handler = uas_eh_abort_handler,
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h
index ccc113e..53341a7 100644
--- a/drivers/usb/storage/unusual_uas.h
+++ b/drivers/usb/storage/unusual_uas.h
@@ -64,6 +64,13 @@ UNUSUAL_DEV(0x0bc2, 0x3312, 0x0000, 0x9999,
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_NO_ATA_1X),
+/* Reported-by: David Webb <djw@noc.ac.uk> */
+UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x9999,
+ "Seagate",
+ "Expansion Desk",
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+ US_FL_NO_REPORT_LUNS),
+
/* Reported-by: Hans de Goede <hdegoede@redhat.com> */
UNUSUAL_DEV(0x0bc2, 0x3320, 0x0000, 0x9999,
"Seagate",
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 43576ed..9de988a 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -482,7 +482,7 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags)
US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 |
US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE |
US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES |
- US_FL_MAX_SECTORS_240);
+ US_FL_MAX_SECTORS_240 | US_FL_NO_REPORT_LUNS);
p = quirks;
while (*p) {
@@ -532,6 +532,9 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags)
case 'i':
f |= US_FL_IGNORE_DEVICE;
break;
+ case 'j':
+ f |= US_FL_NO_REPORT_LUNS;
+ break;
case 'l':
f |= US_FL_NOT_LOCKABLE;
break;
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 7f5f78b..245f57d 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -79,6 +79,8 @@
/* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \
US_FLAG(MAX_SECTORS_240, 0x08000000) \
/* Sets max_sectors to 240 */ \
+ US_FLAG(NO_REPORT_LUNS, 0x10000000) \
+ /* Cannot handle REPORT_LUNS */ \
#define US_FLAG(name, value) US_FL_##name = value ,
enum { US_DO_ALL_FLAGS };
--
2.7.3
^ permalink raw reply related [flat|nested] 7+ messages in thread[parent not found: <1459426971-11927-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] uas: Add a new NO_REPORT_LUNS quirk
[not found] ` <1459426971-11927-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2016-03-31 14:17 ` Alan Stern
0 siblings, 0 replies; 7+ messages in thread
From: Alan Stern @ 2016-03-31 14:17 UTC (permalink / raw)
To: Hans de Goede
Cc: Greg Kroah-Hartman, Gerd Hoffmann, David Webb,
linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-scsi-u79uwXL29TY76Z2rM5mHXA, stable-u79uwXL29TY76Z2rM5mHXA
On Thu, 31 Mar 2016, Hans de Goede wrote:
> 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.
> @@ -532,6 +532,9 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags)
> case 'i':
> f |= US_FL_IGNORE_DEVICE;
> break;
> + case 'j':
> + f |= US_FL_NO_REPORT_LUNS;
> + break;
> case 'l':
> f |= US_FL_NOT_LOCKABLE;
> break;
You forgot to document this new module parameter flag in
Documentation/kernel-parameters.txt.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] uas: Add a new NO_REPORT_LUNS quirk
2016-03-31 12:22 [PATCH] uas: Add a new NO_REPORT_LUNS quirk Hans de Goede
[not found] ` <1459426971-11927-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2016-03-31 14:48 ` James Bottomley
2016-03-31 15:03 ` Hans de Goede
1 sibling, 1 reply; 7+ messages in thread
From: James Bottomley @ 2016-03-31 14:48 UTC (permalink / raw)
To: Hans de Goede, Greg Kroah-Hartman, Gerd Hoffmann
Cc: David Webb, linux-usb, linux-scsi, stable
On Thu, 2016-03-31 at 14:22 +0200, Hans de Goede wrote:
> 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.
Actually, if we're sending them a report luns command, they must be
reporting in at SCSI-3 SPC or higher. Should we be quirking them down
to SCSI-2 instead because it reduces the risk of running into something
else they're not doing from the SPC command set?
James
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] uas: Add a new NO_REPORT_LUNS quirk
2016-03-31 14:48 ` James Bottomley
@ 2016-03-31 15:03 ` Hans de Goede
[not found] ` <56FD3C27.2050708-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Hans de Goede @ 2016-03-31 15:03 UTC (permalink / raw)
To: James Bottomley, Greg Kroah-Hartman, Gerd Hoffmann
Cc: David Webb, linux-usb, linux-scsi, stable
Hi,
On 31-03-16 16:48, James Bottomley wrote:
> On Thu, 2016-03-31 at 14:22 +0200, Hans de Goede wrote:
>> 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.
>
> Actually, if we're sending them a report luns command, they must be
> reporting in at SCSI-3 SPC or higher. Should we be quirking them down
> to SCSI-2 instead because it reduces the risk of running into something
> else they're not doing from the SPC command set?
These are fairly new devices, so they should really be scsi3, but the
usb <-> sata bridge (presumably) used does not seem to like report_luns.
Note that usb-storage simple sets no_report_luns conditionally for all
usb-storage devices. The scsi people have repeatedly asked me to not
do this kinda blanket blacklisting for uas devices, because they hope
that uas will allow them to more or less do proper scsi over usb, so
we end up with blacklisting specific commands every now and then to
get devices to work.
Regards,
Hans
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-03-31 17:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-31 12:22 [PATCH] uas: Add a new NO_REPORT_LUNS quirk Hans de Goede
[not found] ` <1459426971-11927-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-31 14:17 ` Alan Stern
2016-03-31 14:48 ` James Bottomley
2016-03-31 15:03 ` Hans de Goede
[not found] ` <56FD3C27.2050708-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-31 15:11 ` James Bottomley
2016-03-31 15:23 ` Hans de Goede
[not found] ` <56FD40FE.3030302-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-31 17:35 ` David Webb
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox