* ide-cd.c, "MEDIUM_ERROR" handling
@ 2006-04-18 1:18 Zinx Verituse
2006-04-18 11:04 ` Alan Cox
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Zinx Verituse @ 2006-04-18 1:18 UTC (permalink / raw)
To: lkml, Jens Axboe
I recently bought a DVD drive which appears to not retry enough when it's
having trouble reading a disc - I'm requesting an option (or changing the
default behavior) so that this drive is actually usable with the Linux
ide-cd drivers - specificly, the code:
} else if (sense_key == MEDIUM_ERROR) {
/* No point in re-trying a zillion times on a bad
* sector... If we got here the error is not correctable */
ide_dump_status (drive, "media error (bad sector)", stat);
do_end_request = 1;
}
needs to be disabled for my drive to read CDs properly.
With this code enabled, no retries are made, and the kernel sees medium errors
and returns bad data to the application reading; without it, the kernel retries
transparently and reads the data perfectly. So, I think the comment is
assuming decent hardware, which unfortunately isn't always what we have :/
I can make the patch for conditionally enabling/disabling it if needed.
I think it may make more sense to retry by default, but I don't know the
general state of modern cheap CD/DVD drives either. It seems like it's
a corner case on hardware that does re-try a zillion times, though, so
probably won't greatly affect that hardware like it does the hardware
that doesn't re-try a zillion times.
I'm not on the list currently, so please CC me with any replies.
--
Zinx Verituse http://zinx.xmms.org/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: ide-cd.c, "MEDIUM_ERROR" handling
2006-04-18 1:18 ide-cd.c, "MEDIUM_ERROR" handling Zinx Verituse
@ 2006-04-18 11:04 ` Alan Cox
2006-04-18 15:20 ` Gunther Mayer
2006-04-18 16:54 ` Erik Andersen
2 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2006-04-18 11:04 UTC (permalink / raw)
To: Zinx Verituse; +Cc: lkml, Jens Axboe
On Llu, 2006-04-17 at 20:18 -0500, Zinx Verituse wrote:
> I recently bought a DVD drive which appears to not retry enough when it's
> having trouble reading a disc
Different to everything else I've ever met. You might want to check if
its got PC firmware or is actually from a set of drives that were meant
to be supplied in DVD players and similar.
> With this code enabled, no retries are made, and the kernel sees medium errors
> and returns bad data to the application reading; without it, the kernel retries
> transparently and reads the data perfectly. So, I think the comment is
> assuming decent hardware, which unfortunately isn't always what we have :/
Use ide-scsi or the new libata drivers, either will do retries on medium
errors.
Alan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ide-cd.c, "MEDIUM_ERROR" handling
2006-04-18 1:18 ide-cd.c, "MEDIUM_ERROR" handling Zinx Verituse
2006-04-18 11:04 ` Alan Cox
@ 2006-04-18 15:20 ` Gunther Mayer
2006-04-18 16:54 ` Erik Andersen
2 siblings, 0 replies; 4+ messages in thread
From: Gunther Mayer @ 2006-04-18 15:20 UTC (permalink / raw)
To: Zinx Verituse; +Cc: lkml
Zinx Verituse wrote:
>I recently bought a DVD drive which appears to not retry enough when it's
>having trouble reading a disc - I'm requesting an option (or changing the
>default behavior) so that this drive is actually usable with the Linux
>ide-cd drivers - specificly, the code:
> } else if (sense_key == MEDIUM_ERROR) {
> /* No point in re-trying a zillion times on a bad
> * sector... If we got here the error is not correctable */
> ide_dump_status (drive, "media error (bad sector)", stat);
> do_end_request = 1;
> }
>needs to be disabled for my drive to read CDs properly.
>
>With this code enabled, no retries are made, and the kernel sees medium errors
>and returns bad data to the application reading;
>
It would be a kernel bug if it returns bad data. It should return an
error code to the application.
- The device should implement a decent retry strategy.
- There are special forensic applications which can be tuned to re-read
bad sectors multiple times if needed.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: ide-cd.c, "MEDIUM_ERROR" handling
2006-04-18 1:18 ide-cd.c, "MEDIUM_ERROR" handling Zinx Verituse
2006-04-18 11:04 ` Alan Cox
2006-04-18 15:20 ` Gunther Mayer
@ 2006-04-18 16:54 ` Erik Andersen
2 siblings, 0 replies; 4+ messages in thread
From: Erik Andersen @ 2006-04-18 16:54 UTC (permalink / raw)
To: Zinx Verituse; +Cc: lkml, Jens Axboe
On Mon Apr 17, 2006 at 08:18:39PM -0500, Zinx Verituse wrote:
> I recently bought a DVD drive which appears to not retry enough when it's
> having trouble reading a disc - I'm requesting an option (or changing the
> default behavior) so that this drive is actually usable with the Linux
> ide-cd drivers - specificly, the code:
> } else if (sense_key == MEDIUM_ERROR) {
> /* No point in re-trying a zillion times on a bad
> * sector... If we got here the error is not correctable */
> ide_dump_status (drive, "media error (bad sector)", stat);
> do_end_request = 1;
> }
> needs to be disabled for my drive to read CDs properly.
When I originally added this code, the problem I was seeing was
the ide layer was doing 8 retires before it returned to ide-cd,
which then did 8 retries itself. Thus processing a bad sector
caused no less than 64 reads of the bad sector, all of which
failed, and each of which took a fair amount of time, thereby
keeping user space stuck in D state for over 10 minutes on a
single syscall, which seemed rather bad form...
When I added this code, I was relying on the ide layer to
continue to do its ritualistic 8 retries, after which I assumed
that no further retries would be likely to help and there was no
reason for ide-cd to keep thrashing on the already proven to be
dead sector. For my purposes, this helped considerably reduce
the amount of time stuck in D state while processing CDs with bad
sectors (such as trying to recover the data off my kid's
massively scratched up game CDs).
-Erik
--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-04-18 16:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-18 1:18 ide-cd.c, "MEDIUM_ERROR" handling Zinx Verituse
2006-04-18 11:04 ` Alan Cox
2006-04-18 15:20 ` Gunther Mayer
2006-04-18 16:54 ` Erik Andersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox