2.4.9: strange stale buffers when reading partition table (USB/SCSI)

Jeremy Fitzhardinge (jeremy@goop.org)
Wed, 26 Sep 2001 19:37:10 -0700 (PDT)


I have a Sony DSC F505V digital camera, which allows you to download images by
presenting itself as a USB storage device containing a single partition with a
FAT filesystem on it.

The camera is detected by USB, and SCSI will talk to it, but it fails to find
the partition table. I added some code after the bread() in
fs/partitions/msdos.c:443 to dump the read data, which shows that it is getting
garbage. It has relation to anything on the actual device, and it changes from
time to time.

The strange thing is that reading the device via /dev/sda works fine. fdisk
shows a valid partition table, and the partition itself looks fine.

If I add:

bh = getblk(dev, 0, get_ptable_blocksize(dev));
if (bh)
bforget(bh);

just before the bread(), the bread gets the correct stuff and can read the
partition table. Everything works fine from there on:

hub.c: USB new device connect on bus1/1, assigned device number 2
scsi0 : SCSI emulation for USB Mass Storage devices
Vendor: Sony Model: Sony DSC Rev: 2.10
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 253696 512-byte hdwr sectors (130 MB)
usb-uhci.c: interrupt, status 3, frame# 207
usb-uhci.c: interrupt, status 3, frame# 213
sda: Write Protect is off
/dev/scsi/host0/bus0/target0/lun0: p1
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 2
scsi singledevice 0 0 0 0
usb-uhci.c: interrupt, status 3, frame# 48
...

So it looks like someone is leaking buffers or something. The bforget() looks
like its simply papering over the symptoms of some other problem, but I don't
know where to start looking. Perhaps there's a SCSI problem which is leaving
stale blocks around, perhaps related to it being a removeable device?

This is 2.4.9-linus with ext3 (though plain 2.4.9 without ext3 behaves in
exactly the same way).

I haven't tried 2.4.10 yet, but it sounds like everything has changed in this
area anyway...

J
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/