Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 250789 - [2.6.27 regression] unable to mount usb-storage device
Summary: [2.6.27 regression] unable to mount usb-storage device
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
Whiteboard: linux-2.6.27-regression
Keywords: InVCS
Depends on:
Reported: 2008-12-13 02:24 UTC by Jason Johnston
Modified: 2009-01-03 02:10 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---

Messages about USB (messages,8.90 KB, text/plain)
2008-12-13 02:25 UTC, Jason Johnston
Kernel Config (config,52.49 KB, text/plain)
2008-12-13 02:26 UTC, Jason Johnston
Last 200 lines of dmesg (dmesg-trimmed,8.81 KB, text/plain)
2008-12-15 06:15 UTC, Jason Johnston
Dmesg during device start (dmesg5,3.90 KB, text/plain)
2008-12-15 23:05 UTC, Jason Johnston
dmesg full (dmesg-compiled,726.64 KB, text/plain)
2008-12-16 00:49 UTC, Jason Johnston
possible fix (patch,902 bytes, patch)
2008-12-16 17:55 UTC, Sergey Ovcharenko
Details | Diff
Final Dmesg Log (dmesg-final,167.51 KB, text/plain)
2008-12-16 23:25 UTC, Jason Johnston
/proc/bus/usb/devices (usb-devices,7.01 KB, text/plain)
2008-12-16 23:25 UTC, Jason Johnston

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Johnston 2008-12-13 02:24:19 UTC
I upgraded my kernel from 2.6.26-r1 to 2.6.27-r1 all the way to 2.6.26-r5 and when I do I am no longer able to mount my external USB hard drives. syslog-ng begins to go haywire filling /var/log/messages with the following:
Dec 12 19:39:47 MasterBox sd 9:0:0:0: [sdc] Sense Key : No Sense [current]                             
Dec 12 19:39:47 MasterBox sd 9:0:0:0: [sdc] Add. Sense: No additional sense information  
This time around I enabled usb debug support, the full text is in the attachment. In addition I'm adding my kernel config.

Reproducible: Always

Steps to Reproduce:
1.make clean && make && make modules_install && make install
2.Reboot to 2.6.27-r*
3.Turn on USB external drive

Actual Results:  
External device not recognized (no /dev/ made for it), tons of error messages dumped to /var/log/messages

Expected Results:  
Create device profile for external device (/dev/sdc1, 2)
Comment 1 Jason Johnston 2008-12-13 02:25:25 UTC
Created attachment 175167 [details]
Messages about USB

First part is when I turn the device on, the second part is the constant loop
Comment 2 Jason Johnston 2008-12-13 02:26:07 UTC
Created attachment 175169 [details]
Kernel Config
Comment 3 Daniel Drake (RETIRED) gentoo-dev 2008-12-14 20:59:58 UTC
Please attach complete logs from a few seconds after you plug the device in, and use "dmesg" to capture the logs rather than /var/log/messages
Comment 4 Sergey Ovcharenko 2008-12-14 21:42:04 UTC
according to 
Dec 12 19:39:47 MasterBox usb-storage: Command READ_10 (10 bytes)
Dec 12 19:39:47 MasterBox usb-storage:  28 00 1d 1c 59 70 00 00 01 00

the buggy sector number is 488397168
Comment 5 Jason Johnston 2008-12-15 06:15:43 UTC
Created attachment 175305 [details]
Last 200 lines of dmesg

I have a USB thumb drive in (/dev/sdc) and it still works, it might be in that report too.
Comment 6 Jason Johnston 2008-12-15 06:19:28 UTC
(In reply to comment #4)
> according to 
> Dec 12 19:39:47 MasterBox usb-storage: Command READ_10 (10 bytes)
> Dec 12 19:39:47 MasterBox usb-storage:  28 00 1d 1c 59 70 00 00 01 00
> the buggy sector number is 488397168

What has changed in the kernel that would allow a buggy sector to be ignored in an earlier release, and cause an infinite loop in a latter release?

In the mean time, should I run some vfat disk checks and try to fix these sectors?
Comment 7 Daniel Drake (RETIRED) gentoo-dev 2008-12-15 10:40:43 UTC
(In reply to comment #5)
> Created an attachment (id=175305) [edit]
> Last 200 lines of dmesg

That's not enough of the log, it doesn't capture when you plug the device in. If that wasn't the whole log, please post the whole thing. If that was the whole log, then you can increase CONFIG_LOG_BUF_SHIFT so that the logs are bigger, or you could wait a few fewer seconds before capturing the log.
Comment 8 Jason Johnston 2008-12-15 23:05:43 UTC
Created attachment 175390 [details]
Dmesg during device start

This is what I captured before it went into the loop. I tried wait for as long as I could before I switched it off. I hope this helps.
Comment 9 Daniel Drake (RETIRED) gentoo-dev 2008-12-15 23:22:39 UTC
This time, you got the start of the log (where the device is plugged in) but it is not long enough. We need to see what comes next, and the point when it enters the loop.

Please post larger logs. Just do this:
1. plug device in
2. Wait 8 seconds
3. unplug
4. dmesg > kernellog.txt

Then attach kernellog.txt here
Comment 10 Jason Johnston 2008-12-16 00:49:34 UTC
Created attachment 175396 [details]
dmesg full

Okay, lets hope this is what you were looking for. I love shell scripts with a sleeper (don't know why I didn't think of it before).
Comment 11 Daniel Drake (RETIRED) gentoo-dev 2008-12-16 12:47:16 UTC
Thanks, those logs now have all the information we need.

Sergey, do you want to work on this one?
Comment 12 Sergey Ovcharenko 2008-12-16 17:55:20 UTC
Created attachment 175498 [details, diff]
possible fix

Jason,try this patch please and let us now if it worked.
Also post this /proc/bus/usb/devices info please.
If you are interested,have a look at this bug it has much in common with yours
Comment 13 Jason Johnston 2008-12-16 23:25:03 UTC
Created attachment 175528 [details]
Final Dmesg Log

No loops in sight
Comment 14 Jason Johnston 2008-12-16 23:25:34 UTC
Created attachment 175529 [details]
Comment 15 Jason Johnston 2008-12-16 23:27:10 UTC
Thanks guys, that seemed to do the trick. The device is now loading without any loops happening. I posted my dmesg after the update, and the usb devices you requested.
Comment 16 Daniel Drake (RETIRED) gentoo-dev 2008-12-16 23:49:38 UTC
Thanks! Reopening until we ship the fix in gentoo-sources
Comment 17 Daniel Drake (RETIRED) gentoo-dev 2008-12-18 17:48:28 UTC
Sergey's patch was accepted upstream so I have queued it for future gentoo-sources releases.

Jason, to answer your earlier question, the problem here is that your device lies about it's capacity. It says it has 1 more sector than it actually has (a common fault in usb-storage hardware, a slight misinterpretation of the SCSI specs). Your device crashes when Linux tries to access the non-existent last sector. This has always been the case, but the difference is that 2.6.27 tries to read the last sector on plugin (to look for partition tables, RAID information, etc) whereas previously you would have had to fill the disk to get this to happen.
Comment 18 Daniel Drake (RETIRED) gentoo-dev 2008-12-19 10:37:04 UTC
Fixed in gentoo-sources-2.6.27-r7
Comment 19 Jeroen Roovers (RETIRED) gentoo-dev 2009-01-03 02:10:34 UTC
*** Bug 253034 has been marked as a duplicate of this bug. ***