Re: A really interesting mass-storage BUG introduced after 2.6.18

Previous thread: USB: gadget: remove duplicated #include by Huang Weiyi on Sunday, January 11, 2009 - 2:25 am. (2 messages)

Next thread: Regression 2.6.28-git: suspend/resume failure. git bisected to usb suspend/resume patch by Christian Borntraeger on Sunday, January 11, 2009 - 5:48 am. (9 messages)
From: Ozan Çağlayan
Date: Sunday, January 11, 2009 - 4:41 am

Hi,

One of our users reported[0] that his 128MB mass storage driver doesn't 
work anymore on our current stock kernel 2.6.25.20 by hotplugging but 
works flawlessly if it was plugged before booting the OS. He also said 
that it was working out of the box with our old kernel 2.6.18. I 
gathered a lot of output and debugging stuff from the user[1][2] and 
found out that the device has some problems with SCSI Inquiry commands 
then I discovered the patch of Alan Stern about the bad residue 
values[3], backported it and no way it didn't solve the problem.

I also suggested to give a try to the current stable 2.6.28 but the 
behaviour is still the same.

When hotplugged, the kernel doesn't detect the partitions in the device 
leaving the block device on its own but if it's plugged during the boot, 
the partitions are correctly detected and have their own /sys/block 
entries. Note that the device reports a "usb embedded hub" beside a mass 
storage device (dunno if it's the case with all of these kind devices).

[0]: http://bugs.pardus.org.tr/show_bug.cgi?id=8369
[1]: http://bugzilla.kernel.org/show_bug.cgi?id=11125
[2]: http://bugs.pardus.org.tr/attachment.cgi?id=3553 (Hotplugged dmesg 
output)
[3]: http://bugs.pardus.org.tr/attachment.cgi?id=3561 (Coldplug dmesg 
output, correctly detected)

Regards,

-- 

Ozan Çağlayan
<ozan_at_pardus.org.tr>

--

From: Alan Stern
Date: Monday, January 12, 2009 - 3:19 pm

Please ask Antoon to collect a usbmon log during a hotplug test.  The 
instructions are in Documentation/usb/usbmon.txt.

Alan Stern

--

From: Ozan Çağlayan
Date: Tuesday, January 13, 2009 - 4:28 am

Here's the usbmon log:

ee5f0100 2494136602 S Ci:1:001:0 s a3 00 0000 0001 0004 4 <
ee5f0100 2494136621 C Ci:1:001:0 0 4 = 00010000
ee5f0100 2494136627 S Ci:1:001:0 s a3 00 0000 0002 0004 4 <
ee5f0100 2494136629 C Ci:1:001:0 0 4 = 00010000
ee5f0100 2494136631 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ee5f0100 2494136633 C Ci:1:001:0 0 4 = 00010000
ee5f0100 2494136635 S Ci:1:001:0 s a3 00 0000 0004 0004 4 <
ee5f0100 2494136637 C Ci:1:001:0 0 4 = 00010000
ee5f0100 2494136639 S Ci:1:001:0 s a3 00 0000 0005 0004 4 <
ee5f0100 2494136641 C Ci:1:001:0 0 4 = 00010000
ee5f0100 2494136643 S Ci:1:001:0 s a3 00 0000 0006 0004 4 <
ee5f0100 2494136644 C Ci:1:001:0 0 4 = 01050100
ee5f0100 2494136646 S Ci:1:001:0 s a3 00 0000 0007 0004 4 <
ee5f0100 2494136648 C Ci:1:001:0 0 4 = 00010000
ee5f0100 2494136650 S Ci:1:001:0 s a3 00 0000 0008 0004 4 <
ee5f0100 2494136652 C Ci:1:001:0 0 4 = 00010000
f7738700 2494136654 S Ii:1:001:1 -115:2048 4 <
ee5f0100 2494136668 S Ci:1:001:0 s a3 00 0000 0001 0004 4 <
ee5f0100 2494136670 C Ci:1:001:0 0 4 = 00010000
ee5f0100 2494136672 S Ci:1:001:0 s a3 00 0000 0002 0004 4 <
ee5f0100 2494136674 C Ci:1:001:0 0 4 = 00010000
ee5f0100 2494136676 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
ee5f0100 2494136678 C Ci:1:001:0 0 4 = 00010000
ee5f0100 2494136679 S Ci:1:001:0 s a3 00 0000 0004 0004 4 <
ee5f0100 2494136681 C Ci:1:001:0 0 4 = 00010000
ee5f0100 2494136683 S Ci:1:001:0 s a3 00 0000 0005 0004 4 <
ee5f0100 2494136685 C Ci:1:001:0 0 4 = 00010000
ee5f0100 2494136693 S Ci:1:001:0 s a3 00 0000 0006 0004 4 <
ee5f0100 2494136695 C Ci:1:001:0 0 4 = 01050100
ee5f0100 2494136697 S Co:1:001:0 s 23 01 0010 0006 0000 0
ee5f0100 2494136699 C Co:1:001:0 0 0
ee5f0100 2494136701 S Ci:1:001:0 s a3 00 0000 0006 0004 4 <
ee5f0100 2494136703 C Ci:1:001:0 0 4 = 01050000
ee5f0100 2494162597 S Ci:1:001:0 s a3 00 0000 0006 0004 4 <
ee5f0100 2494162601 C Ci:1:001:0 0 4 = 01050000
ee5f0100 2494188595 S Ci:1:001:0 s a3 00 0000 0006 0004 4 <
ee5f0100 2494188599 C Ci:1:001:0 0 4 = ...
From: Alan Stern
Date: Wednesday, January 14, 2009 - 8:47 am

...


This shows the computer sending a TEST UNIT READY command to the drive, 
and the drive reporting Unit Attention: Media not present.  So of 
course Linux believes there is no media loaded in the drive and doesn't 
try to read the partition table or anything else.

Presumably if the drive is plugged in during bootup then the BIOS does 
something to make this error status go away.  It's hard to guess what 
that would be, however.

Alan Stern

--

From: Iwo Mergler
Date: Wednesday, January 14, 2009 - 10:13 pm

It could be a matter of timing. Some badly designed USB devices have a
dead time between power-up and being ready, but show up on the bus as
if they where. The "Media not present" thing could be a symptom of this.

To verify it, try inserting the device slowly. The power contacts in
the USB connector are longer than the data contacts and the device gets
more time to boot.

Regards,

Iwo


--

From: Alan Stern
Date: Thursday, January 15, 2009 - 8:13 am

Another timing-sensitive values you can set is the delay_use module
parameter for usb-storage.  It defaults to 5 seconds but perhaps you
need a longer delay.

Alan Stern

--

Previous thread: USB: gadget: remove duplicated #include by Huang Weiyi on Sunday, January 11, 2009 - 2:25 am. (2 messages)

Next thread: Regression 2.6.28-git: suspend/resume failure. git bisected to usb suspend/resume patch by Christian Borntraeger on Sunday, January 11, 2009 - 5:48 am. (9 messages)