Re: high speed data to usb disk makes the kernel think that is has been unmounted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alan,

Unfortunately the options you suggested didn't help.

The patch below works and is tested with Ubuntu kernel 5.4.0.47.50.

I have stress tested the usb system. To the USB is now seven mechanical hard disks and two ssd disks connected. Six processes are at the same time writing random data to the disks. One of them is to the ssd disk I couldn't write data to before without it failed. Also the other usb-ssd disk is my root partition.

Before I applied the patch, my root partition sometimes failed to be kept mounted. Now I have not had any crashes.

This is a quick fix for hard disks, but working. It continued to work when I started three virtualbox guests and let them also do work. The guests' hard disks is on my usb-root partition.

It doesn't work if I also use my usb2ethernet adapter (ID 2001:4a00 D-Link Corp.), although my root partition and two randomize tests survived. Maybe a much larger timeout in this case will help? But this I don't find as a good solution.

The behavior is the same on the other (much slower) computer with a different usb hub. I have also tested it with exactly the same setup as earlier, with no mechanical hard disks, and it works with the patch and not without it.

Any suggestion on how to solve this? In a good way.

Best regards,
Patrik

---start of diff---
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 5b768b80d1ee..3c550934815c 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -105,7 +105,7 @@ MODULE_PARM_DESC(use_both_schemes,
 DECLARE_RWSEM(ehci_cf_port_reset_rwsem);
 EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem);

-#define HUB_DEBOUNCE_TIMEOUT    2000
+#define HUB_DEBOUNCE_TIMEOUT    10000
 #define HUB_DEBOUNCE_STEP      25
 #define HUB_DEBOUNCE_STABLE     100

diff --git a/include/linux/usb.h b/include/linux/usb.h
index 20c555db4621..e64d441bb78f 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1841,8 +1841,8 @@ extern int usb_set_configuration(struct usb_device *dev, int configuration);
  * USB identifies 5 second timeouts, maybe more in a few cases, and a few
  * slow devices (like some MGE Ellipse UPSes) actually push that limit.
  */
-#define USB_CTRL_GET_TIMEOUT    5000
-#define USB_CTRL_SET_TIMEOUT    5000
+#define USB_CTRL_GET_TIMEOUT    10000
+#define USB_CTRL_SET_TIMEOUT    10000


 /**
---end of diff---


On 18/08/2020 20:34, Alan Stern wrote:
On Tue, Aug 18, 2020 at 08:22:55PM +0200, Patrik Nilsson wrote:
Hi Greg,

Thank you for debugging the issue!

Is there a way to set a speed limit to the device? I mean like setting the
usb-quirks. (i.e. usb-storage.quirks=174c:55aa:u)

Instead of buying a new enclosing for the drive... :(
You can try setting usb-storage.quirks=174c:55aa:g or :m.  They will
slow down the data transfer rates.  The :g flag is used by the uas
driver and the :m flag is used by usb-storage.

Alan Stern

--
PGP-key fingerprint: 1B30 7F61 AF9E 538A FCD6  2BE7 CED7 B0E4 3BF9 8D6C




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux