[PATCH] Fix cdrom error handling in 2.6

From: Erik Andersen (andersen_at_codepoet.org)
Date: 08/23/03

  • Next message: Nigel Cunningham: "Re: [PM] Patrick: which part of "maintainer" and "peer review" needs explaining to you?"
    Date:	Fri, 22 Aug 2003 19:21:42 -0600
    To: Linus Torvalds <torvalds@osdl.org>
    
    

    In both 2.4 and in 2.6, error handling for bad cdrom media is
    wrong. And it is my fault I'm afraid, since I botched an earlier
    fix for the problem by putting the fix in the wrong spot.

    My kids have a "Jumpstart Toddlers" cd they have long since
    completely killed, which makes a great test disc. Without this
    fix, the best time projection I can get for completing a dd type
    sector copy is about 2 years... Most of that is spent thrashing
    about in kernel space trying to re-read sectors we already know
    are not correctable.... After the fix, I was able to rip a copy
    the CD (or rather muddle through it getting lots of EIO errors)
    in about 15 minutes.

    Attached is the fix for 2.6.x,

     -Erik

    --
    Erik B. Andersen             http://codepoet-consulting.com/
    --This message was written using 73% post-consumer electrons--
    --- linux-2.6.0-test3/drivers/ide/ide-cd.c.orig	2003-08-22 19:04:36.000000000 -0600
    +++ linux-2.6.0-test3/drivers/ide/ide-cd.c	2003-08-22 19:04:49.000000000 -0600
    @@ -794,16 +794,16 @@
     			   request or data protect error.*/
     			ide_dump_status (drive, "command error", stat);
     			do_end_request = 1;
    -		} else if ((err & ~ABRT_ERR) != 0) {
    -			/* Go to the default handler
    -			   for other errors. */
    -			DRIVER(drive)->error(drive, "cdrom_decode_status",stat);
    -			return 1;
     		} 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;
    +		} else if ((err & ~ABRT_ERR) != 0) {
    +			/* Go to the default handler
    +			   for other errors. */
    +			DRIVER(drive)->error(drive, "cdrom_decode_status",stat);
    +			return 1;
     		} else if ((++rq->errors > ERROR_MAX)) {
     			/* We've racked up too many retries.  Abort. */
     			do_end_request = 1;
    -
    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/
    

  • Next message: Nigel Cunningham: "Re: [PM] Patrick: which part of "maintainer" and "peer review" needs explaining to you?"

    Relevant Pages

    • [PATCH][RESEND] mg_disk: fix issue with data integrity on error in mg_write()
      ... Subject: [PATCH] mg_disk: fix issue with data integrity on error in mg_write ... We cannot acknowledge the sector write before checking its status ... Fix mg_writeto match mg_write_intrin this regard. ... unsigned int sect_num, ...
      (Linux-Kernel)
    • Re: SuSe 9.3: Bad sector on XFS volune, how to fix? CONCLUSION.
      ... and it necesarry fix bad sectors. ... Did not find a bad sector. ... Also it would make sense to only install SUSE on an healthy partition ...
      (alt.os.linux.suse)
    • [PATCH] Fix cdrom error handling in 2.4
      ... In both 2.4 and in 2.6, error handling for bad cdrom media is ... fix for the problem by putting the fix in the wrong spot. ... request or data protect error.*/ ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [RFC PATCHSET linux-2.6-block#for-2.6.31] block: lld cleanup patches
      ... Bartlomiej Zolnierkiewicz wrote: ... Subject: mg_disk: fix issue with data integrity on error in mg_write ... We cannot acknowledge the sector write before checking its status ... Fix mg_writeto match mg_write_intrin this regard. ...
      (Linux-Kernel)
    • chkdsk
      ... I discovered I have a bad sector on my hard drive ... (Acronis True Image couln't create an image) ... CHKDSK to fix it. ... However, on Startup, I get the error ...
      (microsoft.public.windowsxp.perform_maintain)