linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix IDE bus reset and DMA disable when reading blank DVD-R
@ 2003-12-15 13:44 Jon Burgess
  2004-01-05 10:32 ` Catalin BOIE
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Burgess @ 2003-12-15 13:44 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: Type: text/plain, Size: 1660 bytes --]

I've had a problems burning DVD's in linux-2.6.0-test11 using the ide-cd 
driver.

The DVD writing tool, growisofs, attempts to read the blank disk before 
it writes the new data. The drive responds to the read request on blank 
DVD-R's by returning a "blank media" error. The kernel doesn't have any 
special case handling for this sense value and retries the request a 
couple of times, then gives up and does a bus reset and disables DMA to 
the device. Here is the log:

hdd: cdrom_decode_status: status=0x51 { DriveReady SeekComplete Error }
hdd: cdrom_decode_status: error=0x80LastFailedSense 0x08
hdd: cdrom_decode_status: status=0x51 { DriveReady SeekComplete Error }
hdd: cdrom_decode_status: error=0x80LastFailedSense 0x08
hdd: DMA disabled
hdd: ide_intr: huh? expected NULL handler on exit
hdd: ATAPI reset complete

The same thing occurs if I simply try "mount /dev/dvd" on a DVD-R blank.

The sense key value of 8 isn't listed in ide-cd.h, but it is listed in 
scsi.h as a "BLANK_CHECK" error.

I took a look at the code in ide-cd.c and developed the patch attached. 
This handles treats this error condition as a reason to abort the 
request. This behaviour is the same as when I try to do the same thing 
on another drive with a CD-R blank.

With this patch I just get a single "blank media" error, but no bus 
reset and DMA is left enabled. This makes DVD writing with ide-cd work 
well for me.

It looks like the same fix might be desired for 2.4 as well, although is 
perhaps not so important since scsi-ide is normally used instead.

Does the patch look correct?
Should it be applied to 2.6?

Please CC me on any response.

Thanks,
    Jon


[-- Attachment #2: dvd-blank.diff --]
[-- Type: text/plain, Size: 1167 bytes --]

--- linux-2.6.0-test11/drivers/ide/ide-cd.c~	2003-10-10 13:57:03.000000000 +0100
+++ linux-2.6.0-test11/drivers/ide/ide-cd.c	2003-12-14 00:01:27.628417328 +0000
@@ -799,6 +799,10 @@
 			 * 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 (sense_key == BLANK_CHECK) {
+			/* Disk appears blank ?? */
+			ide_dump_status (drive, "media error (blank)", stat);
+			do_end_request = 1;
 		} else if ((err & ~ABRT_ERR) != 0) {
 			/* Go to the default handler
 			   for other errors. */
--- linux-2.6.0-test11/drivers/ide/ide-cd.h~	2003-07-17 23:16:09.000000000 +0100
+++ linux-2.6.0-test11/drivers/ide/ide-cd.h	2003-12-13 23:58:06.900932544 +0000
@@ -501,6 +501,7 @@
 #define ILLEGAL_REQUEST         0x05
 #define UNIT_ATTENTION          0x06
 #define DATA_PROTECT            0x07
+#define BLANK_CHECK             0x08
 #define ABORTED_COMMAND         0x0b
 #define MISCOMPARE              0x0e
 
@@ -578,7 +579,7 @@
 	"Illegal request",
 	"Unit attention",
 	"Data protect",
-	"(reserved)",
+	"Blank check",
 	"(reserved)",
 	"(reserved)",
 	"Aborted command",

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-01-05 11:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-15 13:44 [PATCH] Fix IDE bus reset and DMA disable when reading blank DVD-R Jon Burgess
2004-01-05 10:32 ` Catalin BOIE
2004-01-05 11:51   ` Jon Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).