lkml.org 
[lkml]   [2002]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Linux 2.4.20-pre4-ac1
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--
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:28    [W:0.093 / U:11.404 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site