Skip to contentSkip to conversation

Fix IDE bus reset and DMA disable when reading blank DVD-R

PATCH In review Jon Burgess 3 participants 3 messages Dec 15, 2003 – Jan 5, 2004 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix IDE bus reset and DMA disable when reading blank DVD-R

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

drivers/ide/ide-cd.c renamed from drivers/ide/ide-cd.c~ +4 -0
@@ -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. */
drivers/ide/ide-cd.h renamed from drivers/ide/ide-cd.h~ +2 -1
@@ -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",
#1 lore raw
Quoted 10 lines · Jon Burgess

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:

Quoted 7 lines

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

Same problem here.
When I start writing a dvd, the kernel disables DMA. I can, immediately, enable DMA and all comes back to normal.
So I wish this patch merged.
Thanks!

Quoted 18 lines

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.

Quoted 9 lines

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

Please CC me on any response.

Thanks,
Jon

---
Catalin(ux) BOIE
[email protected]

#2 lore raw
Quoted 4 lines · Catalin BOIE

So I wish this patch merged.

The patch is included in the 2.6.0 formal release.

Jon