lkml.org 
[lkml]   [2004]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectUSB hangs
From
Date
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.

--- 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();
\
 
 \ /
  Last update: 2005-03-22 13:59    [from the cache]
©2003-2011 Jasper Spaans