On 5/26/24 07:53, Joao Machado wrote:
Linux Distribution: Archlinux
Kernel version: 6.9.1
Noticed my "Kingston DataTraveler G2" is unusable on kernel 6.9.x, constantly resetting in a loop:
May 21 21:42:46 oldell kernel: usb 1-1.3: new high-speed USB device number 4 using ehci-pci
May 21 21:42:46 oldell kernel: usb 1-1.3: New USB device found, idVendor=0951, idProduct=1624, bcdDevice= 1.00
May 21 21:42:46 oldell kernel: usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
May 21 21:42:46 oldell kernel: usb 1-1.3: Product: DataTraveler G2
May 21 21:42:46 oldell kernel: usb 1-1.3: Manufacturer: Kingston
May 21 21:42:46 oldell kernel: usb 1-1.3: SerialNumber: 0014780F9955F971A5EC08D7
May 21 21:42:47 oldell kernel: usb-storage 1-1.3:1.0: USB Mass Storage device detected
May 21 21:42:47 oldell kernel: scsi host6: usb-storage 1-1.3:1.0
May 21 21:42:47 oldell kernel: usbcore: registered new interface driver usb-storage
May 21 21:42:47 oldell kernel: usbcore: registered new interface driver uas
May 21 21:42:48 oldell kernel: scsi 6:0:0:0: Direct-Access Kingston DataTraveler G2 1.00 PQ: 0 ANSI: 2
May 21 21:42:48 oldell kernel: sd 6:0:0:0: [sdb] 15654848 512-byte logical blocks: (8.02 GB/7.46 GiB)
May 21 21:42:48 oldell kernel: sd 6:0:0:0: [sdb] Write Protect is off
May 21 21:42:48 oldell kernel: sd 6:0:0:0: [sdb] Mode Sense: 16 24 09 51
May 21 21:42:48 oldell kernel: sd 6:0:0:0: [sdb] Incomplete mode parameter data
May 21 21:42:48 oldell kernel: sd 6:0:0:0: [sdb] Assuming drive cache: write through
May 21 21:42:48 oldell kernel: usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
May 21 21:42:48 oldell kernel: usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
May 21 21:42:48 oldell kernel: usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
May 21 21:42:48 oldell kernel: usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
May 21 21:42:48 oldell kernel: usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
May 21 21:42:49 oldell kernel: usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
May 21 21:42:49 oldell kernel: usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
May 21 21:42:49 oldell kernel: usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
May 21 21:42:49 oldell kernel: usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
May 21 21:42:49 oldell kernel: usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
May 21 21:42:49 oldell kernel: usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
May 21 21:42:50 oldell kernel: usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
May 21 21:42:50 oldell kernel: sd 6:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s
May 21 21:42:50 oldell kernel: sd 6:0:0:0: [sdb] tag#0 Sense Key : Unit Attention [current]
May 21 21:42:50 oldell kernel: sd 6:0:0:0: [sdb] tag#0 Add. Sense: Not ready to ready change, medium may have changed
May 21 21:42:50 oldell kernel: sd 6:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
This is not affecting all USB flash drive models. For instance, this device works fine:
|May 23 20:15:37 oldell kernel: usb 2-1.2: new high-speed USB device number 9 using ehci-pci May 23 20:15:37 oldell kernel: usb 2-1.2: New USB device found, idVendor=6557, idProduct=2031, bcdDevice= 1.10 May 23 20:15:37 oldell kernel: usb 2-1.2: New USB device strings:
Mfr=1, Product=2, SerialNumber=3 May 23 20:15:37 oldell kernel: usb 2-1.2: Product: USB DISK 3.0 May 23 20:15:37 oldell kernel: usb 2-1.2: Manufacturer: May 23 20:15:37 oldell kernel: usb 2-1.2: SerialNumber: 070D393C83CB5024 May 23 20:15:37 oldell kernel: usb-storage
2-1.2:1.0: USB Mass Storage device detected May 23 20:15:37 oldell kernel: scsi host6: usb-storage 2-1.2:1.0 May 23 20:15:37 oldell mtp-probe[2300]: checking bus 2, device 9: "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2" May 23 20:15:37 oldell mtp-probe[2300]:
bus: 2, device: 9 was not an MTP device May 23 20:15:37 oldell mtp-probe[2301]: checking bus 2, device 9: "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2" May 23 20:15:37 oldell mtp-probe[2301]: bus: 2, device: 9 was not an MTP device May 23 20:15:38 oldell kernel:
scsi 6:0:0:0: Direct-Access USB DISK 3.0 PMAP PQ: 0 ANSI: 6 May 23 20:15:39 oldell kernel: sd 6:0:0:0: [sdb] 121145344 512-byte logical blocks: (62.0 GB/57.8 GiB) May 23 20:15:39 oldell kernel: sd 6:0:0:0: [sdb] Write Protect is off May 23 20:15:39 oldell kernel: sd
6:0:0:0: [sdb] Mode Sense: 45 00 00 00 May 23 20:15:39 oldell kernel: sd 6:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA May 23 20:15:39 oldell kernel: sdb: sdb1 sdb2 May 23 20:15:39 oldell kernel: sd 6:0:0:0: [sdb] Attached SCSI
removable disk|
Proceeded to bisect the kernel, which points to commit 4f53138fffc2b18396859aa4ff3e7ef2b0839c2b <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4f53138fffc2b18396859aa4ff3e7ef2b0839c2b> causing the issue to surface.
Changing USB port made no difference. Tried the same device on a different computer using kernel 6.9.2 - issue replicates.
Attached bisection log, systemd journal kernel logs.
Thank you for the detailed report and also for having bisected this issue.
Does the patch below help (compile-tested only)?
Thanks,
Bart.
---
drivers/scsi/scsi_devinfo.c | 1 +
drivers/scsi/scsi_scan.c | 2 ++
drivers/scsi/sd.c | 4 ++++
include/scsi/scsi_devinfo.h | 4 +++-
4 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index a7071e71389e..85111e14c53b 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -197,6 +197,7 @@ static struct {
{"INSITE", "I325VM", NULL, BLIST_KEY},
{"Intel", "Multi-Flex", NULL, BLIST_NO_RSOC},
{"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36},
+ {"Kingston", "DataTraveler G2", NULL, BLIST_SKIP_IO_HINTS},
{"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN},
{"Marvell", "Console", NULL, BLIST_SKIP_VPD_PAGES},
{"Marvell", "91xx Config", "1.01", BLIST_SKIP_VPD_PAGES},
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 8300fc28cb10..ca7d14ee4575 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -745,6 +745,8 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
*bflags = scsi_get_device_flags(sdev, &inq_result[8],
&inq_result[16]);
+ sdev_printk(KERN_INFO, sdev, "bflags = %#llx\n", *bflags);
+
/* When the first pass succeeds we gain information about
* what larger transfer lengths might work. */
if (pass == 1) {
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3a43e2209751..fcf3d7730466 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -63,6 +63,7 @@
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_dbg.h>
#include <scsi/scsi_device.h>
+#include <scsi/scsi_devinfo.h>
#include <scsi/scsi_driver.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_host.h>
@@ -3117,6 +3118,9 @@ static void sd_read_io_hints(struct scsi_disk *sdkp, unsigned char *buffer)
struct scsi_mode_data data;
int res;
+ if (sdp->sdev_bflags & BLIST_SKIP_IO_HINTS)
+ return;
+
res = scsi_mode_sense(sdp, /*dbd=*/0x8, /*modepage=*/0x0a,
/*subpage=*/0x05, buffer, SD_BUF_SIZE, SD_TIMEOUT,
sdkp->max_retries, &data, &sshdr);
diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
index 6b548dc2c496..fa8721e49dec 100644
--- a/include/scsi/scsi_devinfo.h
+++ b/include/scsi/scsi_devinfo.h
@@ -69,8 +69,10 @@
#define BLIST_RETRY_ITF ((__force blist_flags_t)(1ULL << 32))
/* Always retry ABORTED_COMMAND with ASC 0xc1 */
#define BLIST_RETRY_ASC_C1 ((__force blist_flags_t)(1ULL << 33))
+/* Do not read the I/O hints mode page */
+#define BLIST_SKIP_IO_HINTS ((__force blist_flags_t)(1ULL << 34))
-#define __BLIST_LAST_USED BLIST_RETRY_ASC_C1
+#define __BLIST_LAST_USED BLIST_SKIP_IO_HINTS
#define __BLIST_HIGH_UNUSED (~(__BLIST_LAST_USED | \
(__force blist_flags_t) \