USB ehci_hcd problem

Eric Battersby gyre-Ja3L+HSX0kI at public.gmane.org
Thu Aug 6 10:11:02 UTC 2009


How do I automate setting
'/sys/block/sdb/device/max_sectors' immediately after connecting
the device?

Why?

My USB 3.5" drives occasionally drop their connection
and leave the ext3 partition corrupted. 
This happens infrequently, thus making it hard to track down.
It happens more typically during large file transfers.

It appears to be a long time known bug, that is elusive and hard to
track down.

   http://bugzilla.kernel.org/show_bug.cgi?id=11159#c68
   https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bug/61235/+activity

Here are my errors, from /var/log/messages: (with minor editing '..')
## after connecting USB drive (ok):
..00:45..sd 7:0:0:0: [sdb] Assuming drive cache: write through
..00:45.. sdb: sdb1 sdb2 sdb3 sdb4
..00:45..sd 7:0:0:0: [sdb] Attached SCSI disk
..00:45..sd 7:0:0:0: Attached scsi generic sg2 type 0
## after mounting USB ext3 partition (ok):
..01:32..kjournald starting.  Commit interval 5 seconds
..01:32..EXT3 FS on sdb1, internal journal
..01:32..EXT3-fs: mounted filesystem with ordered data mode.
## then after running a 'du' command, I got these errors
## and the drive disconnected
..02:40..EXT3-fs error (device sdb1): htree_dirblock_to_tree: bad entry in directory #13812933: inode out of bounds - offset=0, inode=32784893, rec_len=4096, name_len=0
..02:41..EXT3-fs error (device sdb1): htree_dirblock_to_tree: bad entry in directory #13566095: rec_len is smaller than minimal - offset=0, inode=0, rec_len=0, name_len=0
..04:22..usb 6-1: reset high speed USB device using ehci_hcd and address 5
..04:37..usb 6-1: device descriptor read/64, error -110
..04:37..usb 6-1: device descriptor read/64, error -71
..04:37..usb 6-1: reset high speed USB device using ehci_hcd and address 5
   ..
..04:39..usb 6-1: USB disconnect, address 5
..04:39..sd 7:0:0:0: [sdb] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK,SUGGEST_OK
..04:39..end_request: I/O error, dev sdb, sector 22947615


Workaround fixes:

   (1) modprobe -r ehci-hcd
       - this is useless as it reverts to USB 1

   (2) a number of suggested kernel parameter changes
       and then a kernel recompile
       - not certain if these will work, so not my first choice

   (3) echo 64 >/sys/block/sdb/device/max_sectors
       - 'sdb' is an example
       - previous value was '240' in my case
       - this appears to have fixed the problem as I have been monitoring
         /var/log/messages

   (4) mount using 'sync' option
       - tried this but the slow down is too much
       - 'cp' slowed down about 10x with a 1GB file,
         while 'dd bs=100M' was only a little slower
 	- it appears that 'cp' is leveraging its efficiency on
 	  implicit system buffering which 'sync' removes

Now, how do I automate setting
'/sys/block/sdb/device/max_sectors' immediately after connecting
the device?  Note that this path does not exist until
the device is plugged in.


--
Eric B.

--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list