Linux USB
 help / color / mirror / Atom feed
From: Patrik Nilsson <nipatriknilsson@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg KH <gregkh@linuxfoundation.org>, linux-usb@vger.kernel.org
Subject: Re: high speed data to usb disk makes the kernel think that is has been unmounted
Date: Tue, 15 Sep 2020 18:43:49 +0200	[thread overview]
Message-ID: <0975cb43-5520-543c-987c-57de5e7b258b@gmail.com> (raw)
In-Reply-To: <20200818183420.GB152667@rowland.harvard.edu>

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


  reply	other threads:[~2020-09-15 19:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11 17:19 high speed data to usb disk makes the kernel think that is has been unmounted Patrik Nilsson
2020-08-11 17:56 ` Greg KH
2020-08-11 18:34   ` Patrik Nilsson
2020-08-11 18:39     ` Greg KH
2020-08-11 19:31     ` Alan Stern
2020-08-11 21:14       ` Patrik Nilsson
2020-08-12  6:14         ` Greg KH
2020-08-16 15:31           ` Patrik Nilsson
2020-08-18  8:55             ` Greg KH
2020-08-18 18:22               ` Patrik Nilsson
2020-08-18 18:34                 ` Alan Stern
2020-09-15 16:43                   ` Patrik Nilsson [this message]
2020-09-15 18:24                     ` Alan Stern
2020-12-05 11:49                       ` Patrik Nilsson
2020-12-05 15:39                         ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0975cb43-5520-543c-987c-57de5e7b258b@gmail.com \
    --to=nipatriknilsson@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox