Re: [Bugme-new] [Bug 4054] Linux partition table reading

From: Andries Brouwer
Date: Mon Jan 17 2005 - 19:28:42 EST


> Date: Mon, 17 Jan 2005 03:21:30 -0800
> From: bugme-daemon@xxxxxxxx
> Subject: [Bugme-new] [Bug 4054]
>
> Problem Description:
> Dane-elec 512MB USB keychain drive (using factory FAT partitions)
> works fine in windows, and on friend's 2.6.10-rc2-mm4 dual Athlon XP,
> but partition won't mount on my K7/K8 machines.

Solution:

You have enabled CONFIG_ACORN_PARTITION_CUMANA. Don't.

Details:
In partitions/check.c the adfspart_check_CUMANA routine
is called earlier than msdos_partition().
This routine adfspart_check_CUMANA() does an adfs_partition() test to see
whether the thing is an adfs partition. That test does adfs_checkbblk()
which checks a checksum. The probability that random garbage will pass
this test is 1 in 256. Disable CONFIG_ACORN_PARTITION_CUMANA unless you
actually have an Acorn and Cumana partitions.

Remarks:
With low frequency people stumble over this problem.
Typically they enable all possible partition types
and do not read any help texts for the various types,
so adding warnings would not help.

Of course it is a bug that the kernel starts doing random partition
recognition. These USB devices all have a DOS-type partition table.
Certainly msdos_partition() should be tried first for them.

And earlier already, it is bad that block_dev.c:do_open() does an
automatic rescan_partitions().

Every now and then I mumble about these things, and usually Linus
disagrees. However, these days we have udev and partx and
blockdev --rereadpt.
I do not really see any reason why the kernel should do
automatic partition guessing for any disk encountered.
(That is just as bad as automatic mounting for any filesystems seen.)
I suppose we should slowly stop doing that, at least for all non-rootfs disks.

Andries

> Jan 17 03:52:00 erg kernel: SCSI device sda: 985088 512-byte hdwr sectors (504 MB)
> Jan 17 03:52:00 erg kernel: sda: Write Protect is off
> Jan 17 03:52:00 erg kernel: /dev/scsi/host11/bus0/target0/lun0: [CUMANA/ADFS]
> p1<5>Attached scsi removable disk sda at scsi11, channel 0, id 0, lun 0
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/