Bug 7910

Summary: pktcdvd doesn't work with libata JMicron driver
Product: IO/Storage Reporter: Luca Tettamanti (kronos.it)
Component: IDEAssignee: Jens Axboe (axboe)
Status: CLOSED CODE_FIX    
Severity: normal CC: alan
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.20-rc6 Subsystem:
Regression: --- Bisected commit-id:

Description Luca Tettamanti 2007-01-31 11:47:43 UTC
Brief summary:
When using JMicron libata driver (pata_jmicron) all files written to a CDRW with
UDF fs and mounted through pktcdvd are lost after umount. The "legacy" driver
works fine.

Step to reproduce:
root@dreamland:/tmp# pktsetup pkt0 /dev/scd0
pktcdvd: writer pktcdvd0 mapped to sr0
root@dreamland:/tmp# mount -t udf -o rw,noatime /dev/pktcdvd/pkt0 /cdrom
pktcdvd: Fixed packets, 32 blocks, Mode-2 disc
pktcdvd: Max. media speed: 4
pktcdvd: write speed 4x
pktcdvd: 0kB available on disc
UDF-fs INFO UDF 0.9.8.1 (2004/29/09) Mounting volume 'LinuxUDF', timestamp
2007/01/30 18:18 (103c)
root@dreamland:/tmp# touch /cdrom/test
root@dreamland:/tmp# ll /cdrom
total 0
drwxr-xr-x 2 root root 40 2007-01-30 18:18 lost+found
-rw-r--r-- 1 root root  0 2007-01-30 20:42 test
root@dreamland:/tmp# umount /cdrom
root@dreamland:/tmp# mount -t udf -o rw,noatime /dev/pktcdvd/pkt0 /cdrom
pktcdvd: Fixed packets, 32 blocks, Mode-2 disc
pktcdvd: Max. media speed: 4
pktcdvd: write speed 4x
pktcdvd: 0kB available on disc
UDF-fs INFO UDF 0.9.8.1 (2004/29/09) Mounting volume 'LinuxUDF', timestamp
2007/01/30 18:18 (103c)
root@dreamland:/tmp# ll /cdrom
total 0
drwxr-xr-x 2 root root 40 2007-01-30 18:18 lost+found

File is lost (also note that pktcdvd reports wrong disk capacity). I've tried
mounting /dev/scd0 rw *without* pktcdvd and I still lose files.

So to recap, after formatting the disk with UDF:

* libata
 - mount with pktcdvd: all files are lost upon umount
 - mount scd0 w/out pktcdvd: all files are lost upon umount
 - write the disk with cdrecord: OK

 pktcdvd reports wrong capacity:

 pktcdvd: Fixed packets, 32 blocks, Mode-2 disc
 pktcdvd: Max. media speed: 4
 pktcdvd: write speed 4x
 pktcdvd: 0kB available on disc
 UDF-fs INFO UDF 0.9.8.1 (2004/29/09) Mounting volume 'LinuxUDF', timestamp
2007/01/30 18:18 (103c)

* legacy IDE driver
 - mount with pktcdvd: OK
 - write the disk with cdrecord: OK

 pktcdvd reports correct capacity:

 pktcdvd: writer pktcdvd0 mapped to hda
 pktcdvd: Fixed packets, 32 blocks, Mode-2 disc
 pktcdvd: Max. media speed: 4
 pktcdvd: write speed 4x
 pktcdvd: 551232kB available on disc
 UDF-fs INFO UDF 0.9.8.1 (2004/29/09) Mounting volume 'LinuxUDF', timestamp
2007/01/30 22:19 (103c)

The HW is a JMicron controller:
02:00.0 IDE interface: JMicron Technologies, Inc. JMicron 20360/20363 AHCI
Controller (rev 02)
02:00.1 IDE interface: JMicron Technologies, Inc. JMicron 20360/20363 AHCI
Controller (rev 02)

(one of the 2 has PATA ports)

driven either by libata (CONFIG_PATA_JMICRON):

PCI: Enabling device 0000:02:00.1 (0000 -> 0001)
ACPI: PCI Interrupt 0000:02:00.1[B] -> GSI 17 (level, low) -> IRQ 19
PCI: Setting latency timer of device 0000:02:00.1 to 64
ata9: PATA max UDMA/100 cmd 0xAC00 ctl 0xA882 bmdma 0xA400 irq 19
ata10: PATA max UDMA/100 cmd 0xA800 ctl 0xA482 bmdma 0xA408 irq 19
scsi8 : pata_jmicron
ata9.00: ATAPI, max UDMA/33
ata9.01: ATAPI, max UDMA/33
ata9.00: configured for UDMA/33
ata9.01: configured for UDMA/33
scsi9 : pata_jmicron
ATA: abnormal status 0x7F on port 0xA807
scsi 8:0:0:0: CD-ROM            HL-DT-ST DVDRAM GSA-4167B DL13 PQ: 0 ANSI: 5
sr0: scsi3-mmc drive: 48x/48x writer dvd-ram cd/rw xa/form2 cdda tray
Uniform CD-ROM driver Revision: 3.20
sr 8:0:0:0: Attached scsi CD-ROM sr0
sr 8:0:0:0: Attached scsi generic sg1 type 5
scsi 8:0:1:0: CD-ROM            WAITEC   ALADAR/1         B1.5 PQ: 0 ANSI: 5
sr1: scsi3-mmc drive: 16x/40x writer cd/rw xa/form2 cdda tray
sr 8:0:1:0: Attached scsi CD-ROM sr1
sr 8:0:1:0: Attached scsi generic sg2 type 5

or by the legacy driver (CONFIG_BLK_DEV_JMICRON):

Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
JMB361: IDE controller at PCI slot 0000:02:00.1
PCI: Enabling device 0000:02:00.1 (0000 -> 0001)
ACPI: PCI Interrupt 0000:02:00.1[B] -> GSI 17 (level, low) -> IRQ 18
JMB361: chipset revision 2
JMB361: 100% native mode on irq 18
PCI: Setting latency timer of device 0000:02:00.1 to 64
   ide0: BM-DMA at 0xa400-0xa407, BIOS settings: hda:pio, hdb:pio
   ide1: BM-DMA at 0xa408-0xa40f, BIOS settings: hdc:pio, hdd:pio
Probing IDE interface ide0...
hda: HL-DT-ST DVDRAM GSA-4167B, ATAPI CD/DVD-ROM drive
hdb: WAITEC ALADAR/1, ATAPI CD/DVD-ROM drive
ide0 at 0xac00-0xac07,0xa882 on irq 18
Probing IDE interface ide1...
JMB361: IDE controller at PCI slot 0000:02:00.0
PCI: Device 0000:02:00.0 not available because of resource collisions
ACPI: PCI Interrupt 0000:02:00.0[A] -> GSI 16 (level, low) -> IRQ 16
JMB361: BIOS configuration fixed.
JMB361: chipset revision 2
JMB361: 100% native mode on irq 16
JMB361: dma_base is invalid
ide2: JMB361 Bus-Master DMA disabled (BIOS)
JMB361: dma_base is invalid
ide3: JMB361 Bus-Master DMA disabled (BIOS)
Probing IDE interface ide2...
Probing IDE interface ide3...
ALI15X3: IDE controller at PCI slot 0000:05:02.1
ACPI: PCI Interrupt 0000:05:02.1[A] -> GSI 23 (level, low) -> IRQ 19
ALI15X3: chipset revision 198
ALI15X3: 100% native mode on irq 19
ALI15X3: too many IDE interfaces, no room in table
ALI15X3: too many IDE interfaces, no room in table
(hum, must increase MAX_HWIF)
ALI15X3: neither IDE port enabled (BIOS)
hda: ATAPI 40X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache, UDMA(33)
Uniform CD-ROM driver Revision: 3.20
hdb: ATAPI 40X CD-ROM CD-R/RW drive, 8192kB Cache, UDMA(33)

It has been reported that it's not possibile to reproduce the problem with a
different libata driver:
http://lkml.org/lkml/2007/1/31/258
this issue may be specific to JMicron driver.

Original LKML thread for reference:
http://lkml.org/lkml/2007/1/30/289
Comment 1 Luca Tettamanti 2007-02-03 05:21:48 UTC
This bug has been introduced by these 2 commits:
3b00315799d78f76531b71435fbc2643cd71ae4c
406c9b605cbc45151c03ac9a3f95e9acf050808c

and is related to to bug #7810
Comment 2 Alan 2007-06-05 06:17:49 UTC
Please close the bug if it was fixed for you as of 2.6.21
Comment 3 Luca Tettamanti 2007-06-05 06:36:56 UTC
Bug was caused by 3b00315799d78f76531b71435fbc2643cd71ae4c and/or
406c9b605cbc45151c03ac9a3f95e9acf050808c.
Fixed in 2.6.21.