Bug reintroduced in genhd.c

Andries.Brouwer@cwi.nl
Wed, 23 Sep 1998 00:58:14 +0200 (MET DST)


In 2.1.122 I find

- if (heads == 32 || heads == 64 ||
- heads == 128 || heads == 255 ||
- heads == 240) {
+ if (heads == 15 || heads == 16 ||
+ heads == 32 || heads == 64 ||
+ heads == 128 || heads == 240 ||
+ heads == 255) {
(void) ide_xlate_1024(dev, heads
, " [PTBL]");

This was a bug we discussed last month or so on the list,
and corrected. Don't know why somebody decided to reintroduce it.

Doing an ide_xlate_1024 is in principle a very bad idea -
something to be done in emergency cases only.
This translation business is a mess, not something to
do without a very good reason.

The old code said: heads > 16 - this cannot be an original
geometry, it must be a translation. It caused trouble, but
not too much, a reasonable assumption.

However, 15 or 16 heads is quite normal - there is no reason
at all to assume that some translation is active.
This heuristic of looking at the partition table to guess
what the right geometry might be is a very insecure one.
Not all Linux fdisks end partitions on cylinder boundaries
so for many systems this patch will cause trouble. Moreover,
people that have hosed their partition table will now
suddenly find that the kernel uses some strange geometry
to access the disk, and have great problems repairing the
situation with fdisk, because also fdisk will get this silly
geometry from the kernel.
Moreover, this change throws away some disk blocks because
of rounding that occurs, making part of perfectly good
partitions inaccessible.

Please revert this change.

Andries
(please cc me in case of discussion - aeb@cwi.nl)

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