Bug 6694

Summary: SD card after umount defect.
Product: Drivers Reporter: Patrick Matthäi (patrick)
Component: USBAssignee: Greg Kroah-Hartman (greg)
Status: REJECTED UNREPRODUCIBLE    
Severity: high CC: akpm, bunk, greg, patrick, pierre-bugzilla, protasnb, stern
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.22-rc6 Subsystem:
Regression: --- Bisected commit-id:
Bug Depends on:    
Bug Blocks: 5089    

Description Patrick Matthäi 2006-06-15 04:59:15 UTC
Most recent kernel where this bug did not occur: /
Distribution: Debian Sid
Hardware Environment: AMD XP 2600+, K7 Kernel, MSI-K7N2-L
Software Environment: Debian Sid
Problem Description:

After I connected my Digicam ( it's a Jenoptik, Model JDC 3.1 LCD ), there came
a few errors at the dmesg. Here the output:
usb 2-2: new full speed USB device using ohci_hcd and address 3
usb 2-2: configuration #1 chosen from 1 choice
Initializing USB Mass Storage driver...
scsi0 : SCSI eusb 2-2: new full speed USB device using ohci_hcd and address 3
usb 2-2: configuration #1 chosen from 1 choice
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 3
usb-storage: waiting for device to settle before scanning
  Vendor:           Model: DigitalCam Pro    Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 00
usb-storage: device scan complete
SCSI device sda: 497664 512-byte hdwr sectors (255 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 497664 512-byte hdwr sectors (255 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
 sda: sda1
sd 0:0:0:0: Attached scsi removable disk sda
Buffer I/O error on device sda1, logical block 497920
Buffer I/O error on device sda1, logical block 497921
Buffer I/O error on device sda1, logical block 497922
Buffer I/O error on device sda1, logical block 497923
Buffer I/O error on device sda1, logical block 497924
Buffer I/O error on device sda1, logical block 497925
Buffer I/O error on device sda1, logical block 497926
Buffer I/O error on device sda1, logical block 497927
Buffer I/O error on device sda1, logical block 497920
Buffer I/O error on device sda1, logical block 497921
usb 2-2: USB disconnect, address 3
usb 2-2: new full speed USB device using ohci_hcd and address 4
usb 2-2: configuration #1 chosen from 1 choice
scsi1 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 4
usb-storage: waiting for device to settle before scanning
  Vendor:           Model: DigitalCam Pro    Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 00
SCSI device sda: 32768 512-byte hdwr sectors (17 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 32768 512-byte hdwr sectors (17 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
 sda: sda1
sd 1:0:0:0: Attached scsi removable disk sda
usb-storage: device scan complete
usb 2-2: USB disconnect, address 4
usb 2-2: new full speed USB device using ohci_hcd and address 5
usb 2-2: configuration #1 chosen from 1 choice
scsi2 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 5
usb-storage: waiting for device to settle before scanning
  Vendor:           Model: DigitalCam Pro    Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 00
SCSI device sda: 32768 512-byte hdwr sectors (17 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 32768 512-byte hdwr sectors (17 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
 sda: sda1
sd 2:0:0:0: Attached scsi removable disk sda
usb-storage: device scan complete
mulation for USB Mass Storage devices
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 3
usb-storage: waiting for device to settle before scanning
  Vendor:           Model: DigitalCam Pro    Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 00
usb-storage: device scan complete
SCSI device sda: 497664 512-byte hdwr sectors (255 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 497664 512-byte hdwr sectors (255 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
 sda: sda1
sd 0:0:0:0: Attached scsi removable disk sda
Buffer I/O error on device sda1, logical block 497920
Buffer I/O error on device sda1, logical block 497921
Buffer I/O error on device sda1, logical block 497922
Buffer I/O error on device sda1, logical block 497923
Buffer I/O error on device sda1, logical block 497924
Buffer I/O error on device sda1, logical block 497925
Buffer I/O error on device sda1, logical block 497926
Buffer I/O error on device sda1, logical block 497927
Buffer I/O error on device sda1, logical block 497920
Buffer I/O error on device sda1, logical block 497921
usb 2-2: USB disconnect, address 3
usb 2-2: new full speed USB device using ohci_hcd and address 4
usb 2-2: configuration #1 chosen from 1 choice
scsi1 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 4
usb-storage: waiting for device to settle before scanning
  Vendor:           Model: DigitalCam Pro    Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 00
SCSI device sda: 32768 512-byte hdwr sectors (17 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 32768 512-byte hdwr sectors (17 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
 sda: sda1
sd 1:0:0:0: Attached scsi removable disk sda
usb-storage: device scan complete
usb 2-2: USB disconnect, address 4

I ignored this errors and mounted it with vfat to /mnt/digicam, then I copied
one picture from it to my harddisk and I deleted one picture from it. Then I
unmounted it and disconnect it from the usb cable successful.
After that, I wanted to make a new picture, but now with this SD card that I'm
using, the camera goes on, but it reacts on nothing! it makes no pictures, I
cant put it off etc, I have to take out the batterys. If I take out the SD card,
the digicam is working well again.
After that I connected the digicam again with my computer, he didnt found my
digicam, then I reconnnected it, now he can mount it, but he only shows files,
that are on the intern memory of my digicam.

Full dmesg output:
Comment 1 Patrick Matthäi 2006-06-15 05:00:10 UTC
Sorry, here is the dmesg output:

usb 2-2: new full speed USB device using ohci_hcd and address 3
usb 2-2: configuration #1 chosen from 1 choice
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 3
usb-storage: waiting for device to settle before scanning
  Vendor:           Model: DigitalCam Pro    Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 00
usb-storage: device scan complete
SCSI device sda: 497664 512-byte hdwr sectors (255 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 497664 512-byte hdwr sectors (255 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
 sda: sda1
sd 0:0:0:0: Attached scsi removable disk sda
Buffer I/O error on device sda1, logical block 497920
Buffer I/O error on device sda1, logical block 497921
Buffer I/O error on device sda1, logical block 497922
Buffer I/O error on device sda1, logical block 497923
Buffer I/O error on device sda1, logical block 497924
Buffer I/O error on device sda1, logical block 497925
Buffer I/O error on device sda1, logical block 497926
Buffer I/O error on device sda1, logical block 497927
Buffer I/O error on device sda1, logical block 497920
Buffer I/O error on device sda1, logical block 497921
usb 2-2: USB disconnect, address 3
usb 2-2: new full speed USB device using ohci_hcd and address 4
usb 2-2: configuration #1 chosen from 1 choice
scsi1 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 4
usb-storage: waiting for device to settle before scanning
  Vendor:           Model: DigitalCam Pro    Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 00
SCSI device sda: 32768 512-byte hdwr sectors (17 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 32768 512-byte hdwr sectors (17 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
 sda: sda1
sd 1:0:0:0: Attached scsi removable disk sda
usb-storage: device scan complete
usb 2-2: USB disconnect, address 4
usb 2-2: new full speed USB device using ohci_hcd and address 5
usb 2-2: configuration #1 chosen from 1 choice
scsi2 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 5
usb-storage: waiting for device to settle before scanning
  Vendor:           Model: DigitalCam Pro    Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 00
SCSI device sda: 32768 512-byte hdwr sectors (17 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 32768 512-byte hdwr sectors (17 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
 sda: sda1
sd 2:0:0:0: Attached scsi removable disk sda
usb-storage: device scan complete
Comment 2 Matthew Dharm 2006-06-19 18:27:25 UTC
It looks like the filesystem on your card got corrupted.  It indicated that
blocks past the end of the device were in use.

Can you wipe and reformat the card and see if that fixes it?
Comment 3 Patrick Matthäi 2006-06-20 00:47:12 UTC
The problem is, that there were many many pictures that I need and the other
problem is, if I connect the digicam with the card to my pc, nothing happens,
nothing in the dmesg too.
Comment 4 Greg Kroah-Hartman 2006-08-30 01:02:22 UTC
So, can you read the card from another machine?

There's not much we can do here, as the kernel is saying the file system is 
corrupted.
Comment 5 Patrick Matthäi 2006-08-30 04:51:11 UTC
I can read it on other machines now.
I reformated it completly, and checked the card with some tools, but on Linux ( 
current: 2.6.17.11 ), it always shows this in ~ 5-10 lines:
Buffer I/O error on device sda1, logical block 497924

it's working, but if I delete one file from the card, I'll get the problem that 
it isn't working again.
Comment 6 Matthew Dharm 2006-09-09 11:18:29 UTC
Please use fdisk to display the contents of the partition table on the card 
and add that information to this bug report.
Comment 7 Patrick Matthäi 2006-09-10 06:58:12 UTC
I hope you mean this:

Command (m for help): p

Disk /dev/sda: 254 MB, 254803968 bytes
16 heads, 32 sectors/track, 972 cylinders
Units = cylinders of 512 * 512 = 262144 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         973      249019    6  FAT16
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(0, 1, 1) logical=(0, 1, 6)
Partition 1 has different physical/logical endings:
     phys=(972, 15, 32) logical=(972, 12, 27)

Command (m for help):  

dmesg:

ohci_hcd 0000:00:02.0: wakeup
usb 2-3: new full speed USB device using ohci_hcd and address 2
usb 2-3: configuration #1 chosen from 1 choice
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
  Vendor:           Model: DigitalCam Pro    Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 00
usb-storage: device scan complete
SCSI device sda: 497664 512-byte hdwr sectors (255 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 497664 512-byte hdwr sectors (255 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
 sda: sda1
sd 0:0:0:0: Attached scsi removable disk sda
Buffer I/O error on device sda1, logical block 248896
Buffer I/O error on device sda1, logical block 248897
Buffer I/O error on device sda1, logical block 248898
Buffer I/O error on device sda1, logical block 248899
Buffer I/O error on device sda1, logical block 248896
Buffer I/O error on device sda1, logical block 248897
Buffer I/O error on device sda1, logical block 248898
Buffer I/O error on device sda1, logical block 248899
Buffer I/O error on device sda1, logical block 249016
Buffer I/O error on device sda1, logical block 249017
Comment 8 Matthew Dharm 2006-09-10 09:49:09 UTC
Is this the same card?

The key here is the number 497664 -- this is how many sectors your device 
reports having.  In your earlier bug reports, the OS was attempting to access 
sectors beyond the end of the device (a number higher than 497664).  In this 
latest log, it is only that is not the case...
Comment 9 Patrick Matthäi 2006-09-10 09:51:34 UTC
It's still the same card.
Comment 10 Patrick Matthäi 2006-09-10 09:53:29 UTC
Add:

Maybe that's the bug at the module?
At the dmesg you can see, that it is the same card.
Comment 11 Matthew Dharm 2006-09-10 10:16:18 UTC
It seems likely that re-formatting the card has fixed one problem with it, but 
that has simply exposed another problem.

At this point, I need two things:

1) I need to know exactly what you did to produce that last dmesg (or a new 
dmesg with an exact list of steps).

2) You need to turn on CONFIG_UBS_STORAGE_DEBUG and post the logfile from that.
Comment 12 Patrick Matthäi 2006-09-10 10:59:57 UTC
1) I connect the usb cable simply with my usb slot, I haven't done anything.

2) I can do this on monday, no time today to compile a kernel, I'm using the
debian sid kernels.
Comment 13 Patrick Matthäi 2006-09-10 13:46:49 UTC
It's done now.

dmesg:
http://www.linux-development.org/nopaste/?489

version:
me@the-me:~$ uname -r
2.6.17.13

lsmod:
http://www.linux-development.org/nopaste/?490

I hope it will help now.
Comment 14 Matthew Dharm 2006-09-10 13:59:37 UTC
This makes no sense.

Your logfiles show the SCSI layer declaring an error, but there were no I/O 
transactions even attempted.  As far as I can see, the SCSI layer is declaring 
an error without one.

Do you have hald running?
Comment 15 Patrick Matthäi 2006-09-10 14:12:00 UTC
http://www.linux-development.org/nopaste/?492

that's all.
Comment 16 Patrick Matthäi 2006-10-24 02:51:26 UTC
Any new ideas maybe?
Comment 17 Matthew Dharm 2006-10-24 10:19:44 UTC
None, really.  There are two problems:

1) Your logs show I/O errors when no I/O should be pending.  Do you have md
loaded?  That might do it, I guess....

2) The error has moved from beyond the end of the device to the middle.  That
doesn't make much sense at all.  Can you read from the sectors indicated in the
error message with dd (using skip= and count= to get just that sector)?
Comment 18 Patrick Matthäi 2006-10-24 10:51:30 UTC
Yes I could read it.
dmesg shows this I/O bugs only after I connect the cam/card with my usb-slot.

md isn't loaded:
me@the-me:~$ lsmod|grep md
amd74xx                13340  0 [permanent]
ide_core              110984  6
usb_storage,ide_generic,ide_cd,ide_disk,generic,amd74xx

And it still exists in 2.6.18.1
Comment 19 Matthew Dharm 2006-10-24 11:02:57 UTC
Please clarify:

You said you could read it, but you get the I/O errors after connecting.  Are
you saying that you connect the cam, get the errors, then read the sectors with
'dd' and they read JUST FINE???
Comment 20 Patrick Matthäi 2006-10-24 11:14:51 UTC
I uploaded a big file on the card and downloaded it, and checked the md5sum and
it's readable fine. but I still get the errors, but where I reported the bug,
NOTHING worked.
Curious?
Comment 21 Matthew Dharm 2006-10-24 12:24:19 UTC
I still don't understand what your test procedure is.  Can you post a log of
what tests you are doing, and when/where the errors appear?
Comment 22 Patrick Matthäi 2006-10-24 12:43:58 UTC
I created a ~250 mb tar.gz file with some stuff in it, get the md5sum of it,
uploaded it on the card, plugged the card off from the usb slot, plugged it in (
the errors occured again ), copied it down again to my harddisk, checked the
md5sum again and it was the same how at the beginning.

The errors occured ONLY if I connect the card to my usb slot.

sorry for my bad english :)
Comment 23 Matthew Dharm 2006-10-24 16:01:34 UTC
Are the "logical block" numbers always the same?
Comment 24 Adrian Bunk 2006-12-03 09:31:31 UTC
Please reopen this bug if:
- it is still present with kernel 2.6.19 and
- you can provide the requested information.
Comment 25 Patrick Matthäi 2006-12-03 10:44:37 UTC
Hello,
I hope you could wait a few days, at the moment I have to do much for school and
job.
If 2.6.19 releases in debian sid, I will test it again and give you all
informations.
Comment 26 yaayaa 2007-01-31 01:02:24 UTC
More details about the problem.

Hello, I have the same problem with ALL my SD Cards, whatever the card reader I use.

In fact, If I format the SD card with my palm pilot, or with my Digital camera,
as soon as it is plugged in the sd card reader, linux complains about "Buffer
I/O error on device" (always the same logical blocks, whatever the card).

If I format the card under linux with mkfs.vfat -c -F 16 /dev/sdd1 : then block
errors are detected and the 2Go card is usable only as a 1Go 


Hope it helps
Comment 27 Patrick Matthäi 2007-02-26 06:05:48 UTC
I just copied one image from my cam on my pc, the image is correct but dmesg says:


Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
  Vendor:           Model: DigitalCam Pro    Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 00
usb-storage: device scan complete
SCSI device sda: 497664 512-byte hdwr sectors (255 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 497664 512-byte hdwr sectors (255 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
 sda: sda1
 sda: p1 exceeds device capacity
sd 0:0:0:0: Attached scsi removable disk sda
attempt to access beyond end of device
sda: rw=0, want=497831, limit=497664
Buffer I/O error on device sda1, logical block 248896
attempt to access beyond end of device
sda: rw=0, want=497833, limit=497664
Buffer I/O error on device sda1, logical block 248897
attempt to access beyond end of device
sda: rw=0, want=497835, limit=497664
Buffer I/O error on device sda1, logical block 248898
attempt to access beyond end of device
sda: rw=0, want=497837, limit=497664
Buffer I/O error on device sda1, logical block 248899
attempt to access beyond end of device
sda: rw=0, want=497831, limit=497664
Buffer I/O error on device sda1, logical block 248896
attempt to access beyond end of device
sda: rw=0, want=497833, limit=497664
Buffer I/O error on device sda1, logical block 248897
attempt to access beyond end of device
sda: rw=0, want=497835, limit=497664
Buffer I/O error on device sda1, logical block 248898
attempt to access beyond end of device
sda: rw=0, want=497837, limit=497664
Buffer I/O error on device sda1, logical block 248899
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
Buffer I/O error on device sda1, logical block 249016
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
Buffer I/O error on device sda1, logical block 249017
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498007, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498009, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498011, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498013, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498063, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498065, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498067, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498069, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=497831, limit=497664
attempt to access beyond end of device
sda: rw=0, want=497833, limit=497664
attempt to access beyond end of device
sda: rw=0, want=497835, limit=497664
attempt to access beyond end of device
sda: rw=0, want=497837, limit=497664
attempt to access beyond end of device
sda: rw=0, want=497831, limit=497664
attempt to access beyond end of device
sda: rw=0, want=497833, limit=497664
attempt to access beyond end of device
sda: rw=0, want=497835, limit=497664
attempt to access beyond end of device
sda: rw=0, want=497837, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498007, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498009, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498011, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498013, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498063, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498065, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498067, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498069, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sda: rw=0, want=498075, limit=497664
usb 1-3: USB disconnect, address 2
Comment 28 Matthew Dharm 2007-02-26 10:55:05 UTC
Please send a copy of /proc/bus/usb/devices when your camera is attached.  I
want to verify something, but at this point I suspect that this is not a
USB-layer problem.

Again, we're now at a point where something is generating a series of requests
for access beyond the end of the device.  The USB layer doesn't even see these
requests; they are filtered out at the sd/SCSI layer.
Comment 29 Patrick Matthäi 2007-02-27 00:20:59 UTC
T:  Bus=03 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 6
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.06
S:  Manufacturer=Linux 2.6.18-4-k7 ehci_hcd
S:  Product=EHCI Host Controller
S:  SerialNumber=0000:00:02.2
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=256ms

T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 3
B:  Alloc= 14/900 us ( 2%), #Int=  1, #Iso=  0
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.06
S:  Manufacturer=Linux 2.6.18-4-k7 ohci_hcd
S:  Product=OHCI Host Controller
S:  SerialNumber=0000:00:02.1
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=1.5 MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=046d ProdID=c21a Rev= 0.04
S:  Manufacturer=Logitech
S:  Product=Logitech(R) Precision(TM) Gamepad
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr= 50mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=10ms

T:  Bus=02 Lev=01 Prnt=01 Port=02 Cnt=02 Dev#=  3 Spd=1.5 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=046d ProdID=c01e Rev=22.00
S:  Manufacturer=Logitech
S:  Product=USB-PS/2 Optical Mouse
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 98mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=02 Driver=usbhid
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=10ms

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 3
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.06
S:  Manufacturer=Linux 2.6.18-4-k7 ohci_hcd
S:  Product=OHCI Host Controller
S:  SerialNumber=0000:00:02.0
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0733 ProdID=2210 Rev= 1.00
S:  Manufacturer=
S:  Product=DigitalCam Pro
S:  SerialNumber=01.00.00
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=87(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=08(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=89(I) Atr=03(Int.) MxPS=   1 Ivl=1ms
Comment 30 Matthew Dharm 2007-02-27 10:00:00 UTC
As I thought, this is a class-compliant device.  So all the SD virtual/physical
stuff is being done in the hardware adaptor.

At this point, I'm relatively convinced that this isn't a usb-storage issue. 
It's  probably not even a USB issue.  I recommend punting this over to the SCSI
or filesystem folks for further analysis.
Comment 31 Patrick Matthäi 2007-06-13 07:03:08 UTC
It still exists in 2.6.21.5:

usb 1-2: new full speed USB device using ohci_hcd and address 4
usb 1-2: configuration #1 chosen from 1 choice
Initializing USB Mass Storage driver...
scsi2 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 4
usb-storage: waiting for device to settle before scanning
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
scsi 2:0:0:0: Direct-Access              DigitalCam Pro   1.00 PQ: 0 ANSI: 0 CCS
SCSI device sdb: 497664 512-byte hdwr sectors (255 MB)
sdb: Write Protect is off
sdb: Mode Sense: 23 00 00 00
sdb: assuming drive cache: write through
SCSI device sdb: 497664 512-byte hdwr sectors (255 MB)
sdb: Write Protect is off
sdb: Mode Sense: 23 00 00 00
sdb: assuming drive cache: write through
 sdb: sdb1
 sdb: p1 exceeds device capacity
sd 2:0:0:0: Attached scsi removable disk sdb
usb-storage: device scan complete
attempt to access beyond end of device
sdb: rw=0, want=497831, limit=497664
Buffer I/O error on device sdb1, logical block 248896
attempt to access beyond end of device
sdb: rw=0, want=497833, limit=497664
Buffer I/O error on device sdb1, logical block 248897
attempt to access beyond end of device
sdb: rw=0, want=497835, limit=497664
Buffer I/O error on device sdb1, logical block 248898
attempt to access beyond end of device
sdb: rw=0, want=497837, limit=497664
Buffer I/O error on device sdb1, logical block 248899
attempt to access beyond end of device
sdb: rw=0, want=497831, limit=497664
Buffer I/O error on device sdb1, logical block 248896
attempt to access beyond end of device
sdb: rw=0, want=497833, limit=497664
Buffer I/O error on device sdb1, logical block 248897
attempt to access beyond end of device
sdb: rw=0, want=497835, limit=497664
Buffer I/O error on device sdb1, logical block 248898
attempt to access beyond end of device
sdb: rw=0, want=497837, limit=497664
Buffer I/O error on device sdb1, logical block 248899
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
Buffer I/O error on device sdb1, logical block 249016
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
Buffer I/O error on device sdb1, logical block 249017
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498007, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498009, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498011, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498013, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498063, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498065, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498067, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498069, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=497831, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=497833, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=497835, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=497837, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=497831, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=497833, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=497835, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=497837, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498007, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498009, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498011, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498013, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498063, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498065, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498067, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498069, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498071, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498073, limit=497664
attempt to access beyond end of device
sdb: rw=0, want=498075, limit=497664
Comment 32 Patrick Matthäi 2007-06-19 17:17:11 UTC
Still available in 2.6.22-rc5.
Comment 33 Andrew Morton 2007-07-25 15:48:55 UTC
Could be that Linux thinks the device is larger than the device thinks that it is and readahead is going off the end of the partition.  We had a report of that on
lkml recently.

Pierre might have insights...
Comment 34 Pierre Ossman 2007-07-25 16:44:53 UTC
Well, not really. But the problem is the other way around, that Linux thinks the device is smaller than it is (Linux thinks it's 497664 sectors). The partition/filesystem is larger than that though, and Linux does not validate those sizes against device size (I believe there was a good reason for this, but I don't remember what it was right now).

So either Linux and the device(s) you've formatted the card in disagree about the true size of the card, or those other devices have buggy formatting tools.

If you can get access to a native SD host on a Linux machine, you should be able to get more true values of its size.
Comment 35 Pierre Ossman 2007-07-25 16:47:45 UTC
Btw, if the card in the test is a 2 GB card, then I'd guess your camera's USB implementation is crap and cannot export larger devices than 256 MB.
Comment 36 Patrick Matthäi 2007-07-25 23:16:20 UTC
No, this is realy a 256 MB card.
Comment 37 Natalie Protasevich 2008-03-24 17:01:33 UTC
Any updates on this bug, it this still a problem with latest kernel?
Since there are two suspects here (USB and SD), is there a way to isolate a problem? CC-int to Alan hopefully to have a look at this. 
Comment 38 Alan Stern 2008-03-25 12:59:24 UTC
If you're still having problems with this, you can try using fdisk to erase the existing partition on the card and create a new one.  Then run mkdosfs on the new partition.  After that the card will probably work perfectly well with the computer.  The camera might not like it any more, though...

The real problem here is that the partition table created by the camera is all messed up.  Not only does it fail to match the card's size, as reported by the camera, it isn't even self-consistent.  Obviously the camera isn't doing what it should.
Comment 39 Natalie Protasevich 2008-03-25 19:00:07 UTC
Thanks Alan. The bug can be closed I guess, since Linux is not at fault here. Maybe someone disagrees and as per #34 - should some validation be done by the kernel?
Comment 40 Patrick Matthäi 2008-07-13 14:26:13 UTC
Anway I haven't got the cam and the card anymore so on I'll reject this bug.