mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andries.Brouwer@cwi.nl
To: Jochen.Hoenicke@informatik.uni-oldenburg.de,
	linux-kernel@vger.kernel.org
Cc: andre@linux-ide.org
Subject: Re: Bug in EZ-Drive remapping code (ide.c)
Date: Fri, 30 Mar 2001 13:15:31 +0200 (MET DST)	[thread overview]
Message-ID: <UTC200103301115.NAA61753.aeb@vlet.cwi.nl> (raw)

Jochen Hoenicke writes:

    The EZ-Drive remapping code remaps to many sectors, if they are read
    together with sector 0 in one bunch.  This is even documented:

    From linux-2.4.0/drivers/ide/ide.c line 1165:
    /* Yecch - this will shift the entire interval,
       possibly killing some innocent following sector */

Yes, I know - I added that comment.

    This problem hit a GRUB user using linux-2.4.2 but it exists for a
    long time; the remapping code is already in 2.0.xx.  The reason that
    nobody cares is probably because there are only a few programs that
    access /dev/hda directly.

    This is what happened: Grub reads the first track in one bunch and
    since a track has an odd number of sectors, linux adds the first
    sector of the next track to this bunch.  This sector contains the boot
    sector of the first FAT partition.  The result of the remapping is
    that grub can't access that partition.

What one wants is to remap access to sector 0 to sector 1,
and leave all other sectors alone. Thus, if someone asks
for sectors 0 1 2 3 4, she should get sectors 1 1 2 3 4.
Ugly, but can be done. But if someone wants to write
sectors 0 1 2 3 4 then what? Only sectors 1 2 3 4 should be
written, but what to write in sector 1? Nobody knows.
(Probably a write to 0 1 2 3 4 should discard the write to 1.)

Doing this would be a very ugly wart on the IDE driver, and
Mark Lord implemented a much smaller wart: shift transports by 1
if they start at sector 0. This was enough at that time
since only *fdisk and LILO access sector 0 and they do not
read an entire track but just one sector or one block.

So yes, the problem is known, but I do not see a clean solution,
unless the solution is to rip out all this EZ drive nonsense.
(I can well imagine that this would happen in 2.5:
the task of the IDE driver is to transport bits from and to
the disk, not to worry about the contents.)
And even if it were fixed somehow in a 2.4 kernel, lots of
people will have a 2.2 or older system for quite some time
to come. So probably grub should regard this as a quirk in
the Linux handling of disks with EZ drive and adapt
(that is, read sector 0, and then read sectors 1-N,
but do not read 0-N).

Andries

             reply	other threads:[~2001-03-30 11:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-30 11:15 Andries.Brouwer [this message]
2001-03-30 15:53 ` Jochen Hoenicke
2001-04-16  6:35 ` Albert D. Cahalan
  -- strict thread matches above, loose matches on Subject: below --
2001-04-16  8:31 Andries.Brouwer
2001-04-16 19:42 ` Albert D. Cahalan
2001-03-30 10:21 Jochen Hoenicke
2001-03-30 14:58 ` Andre Hedrick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=UTC200103301115.NAA61753.aeb@vlet.cwi.nl \
    --to=andries.brouwer@cwi.nl \
    --cc=Jochen.Hoenicke@informatik.uni-oldenburg.de \
    --cc=andre@linux-ide.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®