Skip to contentSkip to conversation

IDE CDROM tail read errors

DISCUSSION Krzysztof Halasa 4 participants 8 messages Mar 29, 2006 – Apr 12, 2006 libata

lore
Share & tools
lore
#0 lore raw

Hi,

I have performed some CD-ROM read tests. Any thoughts?

The CD-ROM disc is a single Fedora Core 5 disc 1, TDK 650 MB CD-RW 4-speed. This CD-RW was erased with "cdrecord blank=fast" before writing FC5d1 to it (cdrecord FC-5-i386-disc1.iso with no padding, default = TAO mode). cdrecord is FC5's cdrecord-2.01.01.0.a03-3 (i386).

# ls -l FC-5-i386-disc1.iso 
687235072 Mar 21 00:13 FC-5-i386-disc1.iso

Both machines run vanilla kernels (with Alan's PATA libata patch in one case).

# cdrecord -toc

first: 1 last 1
track: 1 lba: 0 ( 0) 00:02:00 adr: 1 control: 4 mode: 1
track:lout lba: 335566 ( 1342264) 74:36:16 adr: 1 control: 4 mode: -1

FC-5-i386-disc1.iso size = 335564 * 2048 bytes, not sure why TOC has 2 more sectors (8 512B sectors) but I'm not a CD expert.

--------------------------------------------------------------------

1. machine 1, VIA KT333 chipset, NEC DVD_RW ND-4550A IDE drive (secondary master, no other IDE devices), Linux 2.6.15 with drivers/ide driver:

# cat /dev/cdrom > img-15.iso
cat: /dev/cdrom: Input/output error
# cat /dev/cdrom > img-15a.iso
cat: /dev/cdrom: Input/output error
# ls -l
-rw-r--r-- 1 root root 687177728 Mar 29 15:51 img-15.iso
-rw-r--r-- 1 root root 687177728 Mar 29 15:58 img-15a.iso

The files are just truncated FC5d1 images (57344 bytes missing).

# cat /sys/block/hdc/size
1342264 (as in TOC)

VP_IDE: chipset revision 6
VP_IDE: not 100% native mode: will probe irqs later
VP_IDE: VIA vt8233a (rev 00) IDE UDMA133 controller on pci0000:00:11.1

    ide0: BM-DMA at 0x7800-0x7807, BIOS settings: hda:pio, hdb:pio
    ide1: BM-DMA at 0x7808-0x780f, BIOS settings: hdc:DMA, hdd:pio

hdc: _NEC DVD_RW ND-4550A, ATAPI CD/DVD-ROM drive
hdc: ATAPI 40X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache, UDMA(33)

hdc: command error: status=0x51 { DriveReady SeekComplete Error }
hdc: command error: error=0x54 { AbortedCommand LastFailedSense=0x05 }
ide: failed opcode was: unknown
end_request: I/O error, dev hdc, sector 1342144
Buffer I/O error on device hdc, logical block 167768
...

Failed sector numbers are 1342144 - 1342256 (increments by 8), logical blocks numbers are 167768 - 167782 (= sector numbers / 8).

It looks like an obvious prefetch bug but given the track length (in TOC) I'm not sure.

--------------------------------------------------------------------

2. machine 1, the same VIA KT333 and NEC 4550A, Linux 2.6.16 + Alan's PATA libata 2.6.16-ide1 patch:

# cat /sys/block/sr0/size
1342264 (i.e., the same as with 2.6.15 + drivers/ide)
# cat /dev/cdrw > img-16a.iso
cat: /dev/cdrw: Input/output error
# cat /sys/block/sr0/size
1342256 (looks like it has been adjusted to .iso image size / 512 when
         the first I/O error occured)
# cat /dev/cdrw > img-16b.iso
# cat /dev/cdrw > img-16c.iso

All three files (including img-16a.iso) are exact copies of the original FC5d1 image.

ata4: PATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0x7808 irq 15
via_do_set_mode: Mode=8 ast broken=Y udma=133 mul=4
t.act8b = 11, t.rec8b = 9, t.active = 10, t.recover = 10
FIT t.act8b = 10, t.rec8b = 8, t.active = 9, t.recover = 9
ata4: dev 0 cfg 49:0b00 82:0000 83:0000 84:0000 85:0000 86:0000 87:0000 88:0407
ata4: dev 0 ATAPI, max UDMA/33
via_do_set_mode: Mode=8 ast broken=Y udma=133 mul=4
t.act8b = 11, t.rec8b = 9, t.active = 10, t.recover = 10
FIT t.act8b = 10, t.rec8b = 8, t.active = 9, t.recover = 9
via_do_set_mode: Mode=12 ast broken=Y udma=133 mul=4
t.act8b = 3, t.rec8b = 1, t.active = 3, t.recover = 1
FIT t.act8b = 2, t.rec8b = 0, t.active = 2, t.recover = 0
via_do_set_mode: Mode=66 ast broken=Y udma=133 mul=4
t.act8b = 3, t.rec8b = 1, t.active = 3, t.recover = 1
FIT t.act8b = 2, t.rec8b = 0, t.active = 2, t.recover = 0
ata4: dev 0 configured for UDMA/33
scsi3 : pata_via
Vendor: _NEC Model: DVD_RW ND-4550A Rev: 1.06
Type: CD-ROM ANSI SCSI revision: 05
sr0: scsi3-mmc drive: 40x/40x writer dvd-ram cd/rw xa/form2 cdda tray

end_request: I/O error, dev sr0, sector 1342256 Buffer I/O error on device sr0, logical block 167782
end_request: I/O error, dev sr0, sector 1342256 Buffer I/O error on device sr0, logical block 167782

(the above errors are printed at the end of first "cat", subsequent "cat" commands are silent).

--------------------------------------------------------------------

3. An old 440BX notebook with CD-224E CD-ROM, Linux 2.6.16 and drivers/ide driver.

The results are essentially identical to the first case - 2.6.15 with drivers/ide driver.

PIIX4: IDE controller at PCI slot 0000:00:07.1
PIIX4: chipset revision 1
PIIX4: not 100% native mode: will probe irqs later

    ide0: BM-DMA at 0xfcd0-0xfcd7, BIOS settings: hda:DMA, hdb:pio
    ide1: BM-DMA at 0xfcd8-0xfcdf, BIOS settings: hdc:DMA, hdd:pio

Probing IDE interface ide0...
hda: IC25N020ATMR04-0, ATA DISK drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
Probing IDE interface ide1...
hdc: CD-224E, ATAPI CD/DVD-ROM drive
ide1 at 0x170-0x177,0x376 on irq 15
hda: max request size: 512KiB
hda: 39070080 sectors (20003 MB) w/1740KiB Cache, CHS=16383/255/63, UDMA(33)
hda: cache flushes supported
hda: hda1 hda2
hdc: ATAPI 24X CD-ROM drive, 128kB Cache, DMA

(Errors etc.)

Signature · 1 line
Krzysztof Halasa
#1 lore raw
Quoted 10 lines
# cdrecord -toc

first: 1 last 1
track: 1 lba: 0 ( 0) 00:02:00 adr: 1 control: 4 mode: 1
track:lout lba: 335566 ( 1342264) 74:36:16 adr: 1 control: 4 mode: -1

FC-5-i386-disc1.iso size = 335564 * 2048 bytes, not sure why TOC has 2 more sectors (8 512B sectors) but I'm not a CD expert.

I have heard from friends that this is due to how readahead works. It reads beyond the end of the track, and logically, the hardware signals an error (leading to missing bytes at the end). It is said to be solved using the -pad option when writing CDs.

^^ I could not reproduce this oddness on my own, though. Just a hint, maybe.

Jan Engelhardt

#4 lore raw
In reply to Krzysztof Halasa
Quoted 5 lines · Krzysztof Halasa
# ls -l
(quoted diff) +0 -2
-rw-r--r-- 1 root root 687177728 Mar 29 15:51 img-15.iso
-rw-r--r-- 1 root root 687177728 Mar 29 15:58 img-15a.iso

The files are just truncated FC5d1 images (57344 bytes missing).

The final partial read is dropped rather than partially completed.

Quoted 9 lines
# cat /sys/block/sr0/size
1342264 (i.e., the same as with 2.6.15 + drivers/ide)
# cat /dev/cdrw > img-16a.iso
cat: /dev/cdrw: Input/output error
# cat /sys/block/sr0/size
1342256 (looks like it has been adjusted to .iso image size / 512 when
         the first I/O error occured)

The SCSI layer does this bit for everyone. Its actually not libata or the PATA drivers that have done the work here. You should find ide-scsi does the same.

I patched the old IDE driver a bit to try and deal with this and if you want the patch to hack on and tidy up further feel free.

#5 lore raw
Quoted 6 lines · Alan Cox
Quoted 2 lines

1342256 (looks like it has been adjusted to .iso image size / 512 when
the first I/O error occured)

The SCSI layer does this bit for everyone. Its actually not libata or the PATA drivers that have done the work here. You should find ide-scsi does the same.

I see. I wonder if TOC track (in 2KB sectors) longer than ISO image is a (recording) bug.

Quoted 2 lines

I patched the old IDE driver a bit to try and deal with this and if you want the patch to hack on and tidy up further feel free.

Thanks but... now I've converted my last machine to PATA-libata and drivers/ide are dead for me:

- no way to hot-swap (permanent modules)
- IRQ timeouts on my EPIA-M (never seen with libata)
- now the "end of medium" problems
- code duplication and different device names

Signature · 1 line
Krzysztof Halasa
#2 lore raw
In reply to Jan Engelhardt
Quoted 4 lines · Jan Engelhardt
Quoted 4 lines

first: 1 last 1
track: 1 lba: 0 ( 0) 00:02:00 adr: 1 control: 4 mode: 1
track:lout lba: 335566 ( 1342264) 74:36:16 adr: 1 control: 4 mode: -1

Quoted 8 lines
Quoted 3 lines

FC-5-i386-disc1.iso size = 335564 * 2048 bytes, not sure why TOC has 2 more sectors (8 512B sectors) but I'm not a CD expert.

I have heard from friends that this is due to how readahead works. It reads beyond the end of the track, and logically, the hardware signals an error (leading to missing bytes at the end). It is said to be solved using the -pad option when writing CDs.

You mean the read error and not TOC <> .iso track length differences?

Signature · 1 line
Krzysztof Halasa
#3 lore raw
Quoted 7 lines
Quoted 5 lines

I have heard from friends that this is due to how readahead works. It reads beyond the end of the track, and logically, the hardware signals an error (leading to missing bytes at the end). It is said to be solved using the -pad option when writing CDs.

You mean the read error and not TOC <> .iso track length differences?

Maps to

if(toc_len >= iso + pad)

      ok;
  else
      b0rk on last sectors;
#6 lore raw
In reply to Alan Cox
Quoted 19 lines · Alan Cox
Quoted 5 lines · Krzysztof Halasa
# ls -l
(quoted diff) +0 -2
-rw-r--r-- 1 root root 687177728 Mar 29 15:51 img-15.iso
-rw-r--r-- 1 root root 687177728 Mar 29 15:58 img-15a.iso

The files are just truncated FC5d1 images (57344 bytes missing).

The final partial read is dropped rather than partially completed.

Quoted 9 lines
# cat /sys/block/sr0/size
1342264 (i.e., the same as with 2.6.15 + drivers/ide)
# cat /dev/cdrw > img-16a.iso
cat: /dev/cdrw: Input/output error
# cat /sys/block/sr0/size
1342256 (looks like it has been adjusted to .iso image size / 512 when
         the first I/O error occured)
Quoted 8 lines

The SCSI layer does this bit for everyone. Its actually not libata or the PATA drivers that have done the work here. You should find ide-scsi does the same.

I patched the old IDE driver a bit to try and deal with this and if you want the patch to hack on and tidy up further feel free.

Any hope in hell of getting this fixed? It's been broken for too long to remember. IIRC the problem is that on a read which hits EOF, instead of returning partial data read and no error, the status returned is just some "didn't work" variant and the partial read is lost. I also seem to remember that if the length of the ISO was a multiple of a magic number, 32k, or the metric hexadecimal phase of the moon, you got a clean EOF.

As you say, ide-scsi fixes this, if the people who don't like it would make the alternatives work right it wouldn't be an issue...

Thanks for the info.

#7 lore raw
Quoted 2 lines · Bill Davidsen

Any hope in hell of getting this fixed? It's been broken for too long to remember. IIRC the problem is that on a read which hits EOF, instead of

The libata layer doesn't have the problem. So it will get fixed as the libata PATA stuff gets upstream and merged