public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Erik Andersen <andersen@codepoet.org>
To: Alan Cox <alan@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Linux 2.4.20-pre4-ac1
Date: Fri, 23 Aug 2002 06:21:50 -0600	[thread overview]
Message-ID: <20020823122149.GA21809@codepoet.org> (raw)
In-Reply-To: <200208231046.g7NAk2914276@devserv.devel.redhat.com>

On Fri Aug 23, 2002 at 06:46:02AM -0400, Alan Cox wrote:
> o	Abort IDE cd reads immediately on medium	(Erik Andersen)
> 	error as that isnt correctable

Note that is this only 1/2 of a fix however...

Suppose for example we write the following stupid app:

    int fd;
    char buf[1024*1024];

    fd = open("/dev/cdrom", O_RDONLY | O_NONBLOCK);

    lseek(fd, offset_near_bad_sector, SEEK_SET);

    if (read(fd, buf, sizeof(buf)) < 0) {
	perror("read");
	return EXIT_FAILURE;
    }
    return 0;

So it wants to read 512 sectors at 'offset_near_bad_sector'.
Lets suppose that the 10th sector after this offset is bad.
So it reads 9 sectors just fine.  Then it hits the bad spot.
After the ide layer decides to pass the error to ide-cd, the
ide-cd driver now calls cdrom_end_request(), per the patch
now in 2.4.20-pre4-ac1, and we abort trying to read the 10th
sector, as expected.

But then the driver proceeds to try and read the other 502
sectors before it throws away the 1MB and returns an EIO to
user space!

Reading the rest of the N sectors after an IO error (only to
throw it all away), is terribly stupid.  It means that when
there is a group of bad sectors on the media, user space
stays stuck in D state for several minutes before we even
find out about the bad sector.  And if you think about why
bad sectors show up on CD-ROM media (at my house think of
children, playing with CDs and sharp objects), you will
realize that groups of bad sectors on the media is actually
the common case...

I spent an hour last night trying to track down where it was
doing the broken "keep reading after an IO error" logic but
I've not yet been able to come up with a proper fix,

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--

  reply	other threads:[~2002-08-23 12:17 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-23 10:46 Linux 2.4.20-pre4-ac1 Alan Cox
2002-08-23 12:21 ` Erik Andersen [this message]
2002-08-23 14:06 ` Eyal Lebedinsky
2002-08-23 14:29   ` Linux 2.4.20-pre4-ac1 (this time regarding 2.5.31) Thunder from the hill
2002-08-23 14:53     ` Steven Cole
2002-08-23 15:07       ` Thunder from the hill
2002-08-23 15:52         ` Greg KH
2002-08-23 15:51   ` Linux 2.4.20-pre4-ac1 Greg KH
2002-08-23 14:59 ` Erik Andersen
2002-08-23 15:16   ` [PATCH] fix bitops.h circular dependancies Erik Andersen
2002-08-23 15:59     ` Erik Andersen
2002-08-23 15:57 ` Linux 2.4.20-pre4-ac1 Markus Plail
2002-08-23 18:16   ` Andre Hedrick
2002-08-23 16:30 ` Anssi Saari
2002-08-23 16:56   ` Markus Plail
2002-08-24 16:03     ` Anssi Saari
2002-08-23 17:18   ` Alan Cox
2002-08-23 19:30     ` Anssi Saari
2002-08-24 13:27 ` Allan Duncan
2002-08-24 13:55   ` Alan Cox
2002-08-24 14:07     ` Erik Andersen
2002-08-25 11:01       ` Tomas Szepe
2002-08-25 11:10         ` Thunder from the hill
2002-08-25 11:32           ` Thomas Molina
2002-08-25 11:45             ` Sean Neakums
2002-08-25 12:10               ` Geert Uytterhoeven
2002-08-25 12:19                 ` Thunder from the hill
2002-08-25 12:25                   ` Sean Neakums
2002-08-25 13:44                     ` Tomas Szepe
2002-08-26  2:01               ` Rik van Riel
2002-08-25 11:41           ` Tomas Szepe
2002-08-26  0:24             ` Allan Duncan
2002-08-25 21:33           ` Henning P. Schmiedehausen
2002-08-24 17:32 ` Axel Siebenwirth
2002-08-24 17:59   ` Alan Cox
2002-08-25  4:49     ` Zephaniah E. Hull
2002-08-25 20:15 ` Adrian Bunk

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=20020823122149.GA21809@codepoet.org \
    --to=andersen@codepoet.org \
    --cc=alan@redhat.com \
    --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