From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com.br>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: USB hangs
Date: Sun, 11 Jan 2004 00:07:17 +0000 [thread overview]
Message-ID: <1073779636.17720.3.camel@dhcp23.swansea.linux.org.uk> (raw)
[-- Attachment #1: Type: text/plain, Size: 623 bytes --]
With the various fixes people had been posting USB storage
writing was still hanging repeatedly when doing a 20Gb rsync
to usb-storage disks with a low memory system. Doing things
like while(true) sync() made it hang even more often.
After a bit of digging the following seems to fix it
Not sure if 2.6 needs this as well.
The failure path seems to be
->scsi_done in the USB storage thread
issues a new command
causes USB to kmalloc GFP_KERNEL
causes a page out
queues a page out to the USB storage thread
Deadlock.
Setting PF_MEMALLOC should stop the storage thread ever causing pageout
itself so deadlocking.
[-- Attachment #2: a1 --]
[-- Type: text/plain, Size: 335 bytes --]
--- drivers/usb/storage/usb.c~ 2004-01-09 02:06:35.000000000 +0000
+++ drivers/usb/storage/usb.c 2004-01-09 02:06:35.000000000 +0000
@@ -332,6 +332,8 @@
/* set our name for identification purposes */
sprintf(current->comm, "usb-storage-%d", us->host_number);
+
+ current->flags |= PF_MEMALLOC;
unlock_kernel();
next reply other threads:[~2004-01-11 0:10 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-11 0:07 Alan Cox [this message]
2004-01-11 0:23 ` Matthew Dharm
2004-01-11 0:49 ` [linux-usb-devel] " Oliver Neukum
2004-01-11 1:01 ` Matthew Dharm
2004-01-11 1:06 ` Oliver Neukum
2004-01-11 1:40 ` David Brownell
2004-01-11 2:33 ` Alan Cox
2004-01-11 8:02 ` [linux-usb-devel] " Oliver Neukum
2004-01-11 22:39 ` Alan Cox
2004-01-11 23:29 ` Oliver Neukum
2004-01-12 15:53 ` Alan Stern
2004-01-11 23:25 ` David Brownell
2004-01-11 23:31 ` Matthew Dharm
2004-01-12 4:11 ` David Brownell
2004-01-12 7:39 ` Matthew Dharm
2004-01-12 8:37 ` Oliver Neukum
2004-01-12 16:27 ` Alan Stern
2004-01-12 20:56 ` Alan Cox
2004-01-16 13:14 ` Pavel Machek
2004-01-11 23:33 ` Oliver Neukum
2004-01-12 0:09 ` Alan Cox
2004-01-12 0:25 ` Matthew Dharm
2004-01-11 18:46 ` Lukas Postupa
2004-01-11 20:04 ` Matthew Dharm
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=1073779636.17720.3.camel@dhcp23.swansea.linux.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com.br \
/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
all inboxes | Powered by JetHome®