]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
USB: UAS: introduce a quirk to set no_write_same
authorOliver Neukum <oneukum@suse.com>
Wed, 9 Dec 2020 15:26:39 +0000 (16:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Dec 2020 12:46:46 +0000 (13:46 +0100)
commit 8010622c86ca5bb44bc98492f5968726fc7c7a21 upstream.

UAS does not share the pessimistic assumption storage is making that
devices cannot deal with WRITE_SAME.  A few devices supported by UAS,
are reported to not deal well with WRITE_SAME. Those need a quirk.

Add it to the device that needs it.

Reported-by: David C. Partridge <david.partridge@perdrix.co.uk>
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201209152639.9195-1-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/admin-guide/kernel-parameters.txt
drivers/usb/storage/uas.c
drivers/usb/storage/unusual_uas.h
drivers/usb/storage/usb.c
include/linux/usb_usual.h

index 357c64b53cdc7146c43fe1adac26db7fdb7b32f6..3a1507362eb1ee427691c8ed2387ed2616a963e8 100644 (file)
                                        device);
                                j = NO_REPORT_LUNS (don't use report luns
                                        command, uas only);
+                               k = NO_SAME (do not use WRITE_SAME, uas only)
                                l = NOT_LOCKABLE (don't try to lock and
                                        unlock ejectable media, not on uas);
                                m = MAX_SECTORS_64 (don't transfer more
index 6234cee50a88950598f5cbd5334ccca153aae39c..e9ca6f13dbf2d2efce93df5e3b6daab4e5ccb6b5 100644 (file)
@@ -874,6 +874,9 @@ static int uas_slave_configure(struct scsi_device *sdev)
        if (devinfo->flags & US_FL_NO_READ_CAPACITY_16)
                sdev->no_read_capacity_16 = 1;
 
+       /* Some disks cannot handle WRITE_SAME */
+       if (devinfo->flags & US_FL_NO_SAME)
+               sdev->no_write_same = 1;
        /*
         * Some disks return the total number of blocks in response
         * to READ CAPACITY rather than the highest block number.
index 018b0663d6109dab13160ba420bdc06f2bfd23c0..61891c2dc9fcc9203bd51042b1b7f2392872b0b3 100644 (file)
@@ -48,12 +48,15 @@ UNUSUAL_DEV(0x054c, 0x087d, 0x0000, 0x9999,
                USB_SC_DEVICE, USB_PR_DEVICE, NULL,
                US_FL_NO_REPORT_OPCODES),
 
-/* Reported-by: Julian Groß <julian.g@posteo.de> */
+/*
+ *  Initially Reported-by: Julian Groß <julian.g@posteo.de>
+ *  Further reports David C. Partridge <david.partridge@perdrix.co.uk>
+ */
 UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999,
                "LaCie",
                "2Big Quadra USB3",
                USB_SC_DEVICE, USB_PR_DEVICE, NULL,
-               US_FL_NO_REPORT_OPCODES),
+               US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME),
 
 /*
  * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI
index 0dceb9fa3a0629af3bd1a1990508d2c32bb42db2..2b6f8600c594b09d2ab932a1f1202020d8298c0a 100644 (file)
@@ -557,6 +557,9 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags)
                case 'j':
                        f |= US_FL_NO_REPORT_LUNS;
                        break;
+               case 'k':
+                       f |= US_FL_NO_SAME;
+                       break;
                case 'l':
                        f |= US_FL_NOT_LOCKABLE;
                        break;
index 000a5954b2e89b1397cee2852d597baf74c82b26..a7f7ebdd3069ed1155803190ee2d1ea36cfb7805 100644 (file)
@@ -84,6 +84,8 @@
                /* Cannot handle REPORT_LUNS */                 \
        US_FLAG(ALWAYS_SYNC, 0x20000000)                        \
                /* lies about caching, so always sync */        \
+       US_FLAG(NO_SAME, 0x40000000)                            \
+               /* Cannot handle WRITE_SAME */                  \
 
 #define US_FLAG(name, value)   US_FL_##name = value ,
 enum { US_DO_ALL_FLAGS };