Problems with eject and pktcdvd
Recently I bought a NEC ND-4551A CD/DVD writer. It works OK with one exception. When I have a packet device associated with the drive, there are problems with ejecting discs.
Here is an example:
1. Insert a CD-R/DVD/CD-RW (whatever)
2. mount /media/cdrom0
3. umount /media/cdrom0
Now the eject button doesn't work, when I issue the eject command I get:
hda: irq timeout: status=0xd0 { Busy }
ide: failed opcode was: unknown
hda: DMA disabled
hda: ATAPI reset complete
After few seconds eject ends with no result. Second eject command works.
There are no problems without the packet device association (turned off/on with pktsetup using /etc/init.d/udftools).
My system if Ubuntu 5.10
The kernel is:
Linux amd 2.6.15-mm3 #1 PREEMPT Sun Jan 15 12:31:14 CET 2006 i686 GNU/Linux
But it works the same way with 2.6.15.
Part of my dmesg related to IDE:
VP_IDE: IDE controller at PCI slot 0000:00:11.1
ACPI: PCI Interrupt 0000:00:11.1[A] -> Link [LNKA] -> GSI 10 (level, low)
-> IRQ 10
PCI: Via IRQ fixup for 0000:00:11.1, from 255 to 10VP_IDE: chipset revision 6VP_IDE: not 100% native mode: will probe irqs laterVP_IDE: VIA vt8233a (rev 00) IDE UDMA133 controller on pci0000:00:11.1
ide0: BM-DMA at 0xdc00-0xdc07, BIOS settings: hda:DMA, hdb:pio
ide1: BM-DMA at 0xdc08-0xdc0f, BIOS settings: hdc:pio, hdd:pioProbing IDE interface ide0...
hda: _NEC DVD_RW ND-4551A, ATAPI CD/DVD-ROM drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
hda: ATAPI 48X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache, UDMA(33) Uniform CD-ROM driver Revision: 3.20
Probing IDE interface ide1...
Probing IDE interface ide1...
Signature · 1 line
Damian Pietras
I am currently working on improving the udftools package in ubuntu to make it actually usable. In its current state it is only suitable for experimentation. See the thread titled "[PATCH] pktcdvd & udf bugfixes" on this mailing list for more information.
Eject works fine for me though so I'm not sure what the problem is. You might want to try using the stock 2.6.12 breezy kernel on your breezy install, instead of your home built 2.6.15-mm kernel. I'm running the stock 2.6.15 kernel on my dapper install and eject works just fine once unmounted.
If you feel like building the package and testing it, it's up on REVU right now at http://revu.tauware.de/details.py?upid=1433
That contains a few bug fixes discussed in the other thread I refered you to. I am still trying to get the package integrated with hal so it's all plug and play automagic, but running into some trouble there.
Quoted 47 lines · Damian Pietras
Recently I bought a NEC ND-4551A CD/DVD writer. It works OK with one exception. When I have a packet device associated with the drive, there are problems with ejecting discs.
Here is an example:
1. Insert a CD-R/DVD/CD-RW (whatever)
2. mount /media/cdrom0
3. umount /media/cdrom0Now the eject button doesn't work, when I issue the eject command I get:
hda: irq timeout: status=0xd0 { Busy }
ide: failed opcode was: unknown
hda: DMA disabled
hda: ATAPI reset completeAfter few seconds eject ends with no result. Second eject command works.
There are no problems without the packet device association (turned off/on with pktsetup using
/etc/init.d/udftools).My system if Ubuntu 5.10
The kernel is:
Linux amd 2.6.15-mm3 #1 PREEMPT Sun Jan 15 12:31:14 CET 2006 i686 GNU/Linux
But it works the same way with 2.6.15.Part of my dmesg related to IDE:
VP_IDE: IDE controller at PCI slot 0000:00:11.1
ACPI: PCI Interrupt 0000:00:11.1[A] -> Link [LNKA] -> GSI 10 (level, low)
-> IRQ 10
PCI: Via IRQ fixup for 0000:00:11.1, from 255 to 10VP_IDE: chipset revision 6VP_IDE: not 100% native mode: will probe irqs laterVP_IDE: VIA vt8233a (rev 00) IDE UDMA133 controller on pci0000:00:11.1ide0: BM-DMA at 0xdc00-0xdc07, BIOS settings: hda:DMA, hdb:pio ide1: BM-DMA at 0xdc08-0xdc0f, BIOS settings: hdc:pio, hdd:pioProbing IDE interface ide0...
hda:_NECDVD_RWND-4551A, ATAPI CD/DVD-ROM drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
hda: ATAPI 48X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache, UDMA(33) Uniform CD-ROM driver Revision: 3.20
Probing IDE interface ide1...
Probing IDE interface ide1...
Quoted 10 lines · Phillip Susi
I am currently working on improving the udftools package in ubuntu to make it actually usable. In its current state it is only suitable for experimentation. See the thread titled "[PATCH] pktcdvd & udf bugfixes" on this mailing list for more information.
Eject works fine for me though so I'm not sure what the problem is. You might want to try using the stock 2.6.12 breezy kernel on your breezy install, instead of your home built 2.6.15-mm kernel. I'm running the stock 2.6.15 kernel on my dapper install and eject works just fine once unmounted.
Neither Ubuntu kernel nor this patch fixes the problem.
Quoted 3 lines
If you feel like building the package and testing it, it's up on REVU right now at http://revu.tauware.de/details.py?upid=1433
This is just updated udftools package? I don't think it's a userspace problem. It happens also for CD-Rs with iso9660 filesystem.
Signature · 1 line
Damian Pietras
Quoted 5 lines · Damian Pietras
On Sun, Jan 15, 2006 at 12:53:25PM -0500, Phillip Susi wrote:
Neither Ubuntu kernel nor this patch fixes the problem.
You might want to try it under dapper then. If you still have that problem, then it's got to be busted hardware. You might try updating the firmware in the drive.
Quoted 4 lines
This is just updated udftools package? I don't think it's a userspace problem. It happens also for CD-Rs with iso9660 filesystem.
Right, I just mentioned that because there are a number of fixes that are required to make udftools actually 'usable' which you might be interested in. I also need beta testers :)
Quoted 8 lines · Phillip Susi
Quoted 3 lines · Damian Pietras
On Sun, Jan 15, 2006 at 12:53:25PM -0500, Phillip Susi wrote:
Neither Ubuntu kernel nor this patch fixes the problem.You might want to try it under dapper then. If you still have that problem, then it's got to be busted hardware. You might try updating the firmware in the drive.
The irq timeout problem might be broken hardware/firmware, but there is a problem with drive locking and the pktcdvd driver.
If you do
pktsetup 0 /dev/hdc
mount /dev/hdc /mnt/tmp
umount /mnt/tmp
the door will be left in a locked state. (It gets unlocked when you run "pktsetup -d 0" though.) However, if you do:
pktsetup 0 /dev/hdc
mount /dev/pktcdvd/0 /mnt/tmp
umount /mnt/tmp
the door will be properly unlocked.
The problem is that the cdrom driver locks the door the first time the device is opened in blocking mode, but doesn't unlock it again until the open count goes down to zero. The pktcdvd driver tries to work around that, but it can't do it in the first example because the mount/umount commands do not involve the pktcdvd driver at all.
Signature · 2 lines
Peter Osterlund - [email protected] http://web.telia.com/~u89404340
Quoted 20 lines · Peter Osterlund
Quoted 8 lines · Phillip Susi
Quoted 3 lines · Damian Pietras
On Sun, Jan 15, 2006 at 12:53:25PM -0500, Phillip Susi wrote:
Neither Ubuntu kernel nor this patch fixes the problem.You might want to try it under dapper then. If you still have that problem, then it's got to be busted hardware. You might try updating the firmware in the drive.
The irq timeout problem might be broken hardware/firmware, but there is a problem with drive locking and the pktcdvd driver.
If you do
pktsetup 0
/dev/hdc
mount/dev/hdc/mnt/tmp
umount/mnt/tmp
Quoted 6 lines
the door will be left in a locked state. (It gets unlocked when you run "pktsetup -d 0" though.) However, if you do:
pktsetup 0
/dev/hdc
mount/dev/pktcdvd/0/mnt/tmp
umount/mnt/tmp
Thanks!
It works this way without any irq timeout. Unfortunately I can't use it as a workaround, because CD-R media must be mounted with '-o ro' or I get 'pktcdvd: Wrong disc profile (9)', so I can't just put it in fstab and use 'mount /media/cdrom' for both CD-R and RW discs.
This is very new model and I hope they will release new firmware soon.
Signature · 1 line
Damian Pietras
Quoted 4 lines
Quoted 4 lines
pktsetup 0
/dev/hdc
mount/dev/pktcdvd/0/mnt/tmp
umount/mnt/tmp
A question BTW; I do not seem to need pktcdvd for DVD+RWs, I can just mount them after mkfs'ing /dev/hdc - what's up with that?
Jan Engelhardt
Quoted 6 lines · Jan Engelhardt
Quoted 3 lines
Quoted 3 lines
pktsetup 0
/dev/hdc
mount/dev/pktcdvd/0/mnt/tmp
umount/mnt/tmpA question BTW; I do not seem to need pktcdvd for DVD+RWs, I can just mount them after mkfs'ing
/dev/hdc- what's up with that?
Basically, if you don't use the packet writing driver, the DVD drive firmware will do similar work on its own, because the hardware can only write 32KB blocks. The firmware is often slower than the pktcdvd driver, because the firmware doesn't have as much memory available as the kernel to reorder I/O operations for improved throughput.
See also Documentation/cdrom/packet-writing.txt:
Packet writing for DVD+RW media
-------------------------------
According to the DVD+RW specification, a drive supporting DVD+RW discs shall implement "true random writes with 2KB granularity", which means that it should be possible to put any filesystem with a block size >= 2KB on such a disc. For example, it should be possible to do:
# dvd+rw-format /dev/hdc (only needed if the disc has never
been formatted)
# mkudffs /dev/hdc
# mount /dev/hdc /cdrom -t udf -o rw,noatime
However, some drives don't follow the specification and expect the host to perform aligned writes at 32KB boundaries. Other drives do follow the specification, but suffer bad performance problems if the writes are not 32KB aligned.
Both problems can be solved by using the pktcdvd driver, which always generates aligned writes.
# dvd+rw-format /dev/hdc
# pktsetup dev_name /dev/hdc
# mkudffs /dev/pktcdvd/dev_name
# mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime
Signature · 2 lines
Peter Osterlund - [email protected] http://web.telia.com/~u89404340
Quoted 18 lines · Damian Pietras
Quoted 10 lines · Peter Osterlund
The irq timeout problem might be broken hardware/firmware, but there is a problem with drive locking and the pktcdvd driver.
If you do
pktsetup 0
/dev/hdc
mount/dev/hdc/mnt/tmp
umount/mnt/tmpQuoted 6 lines
the door will be left in a locked state. (It gets unlocked when you run "pktsetup -d 0" though.) However, if you do:
pktsetup 0
/dev/hdc
mount/dev/pktcdvd/0/mnt/tmp
umount/mnt/tmp
Quoted 6 lines
Thanks!
It works this way without any irq timeout. Unfortunately I can't use it as a workaround, because CD-R media must be mounted with '-o ro' or I get 'pktcdvd: Wrong disc profile (9)', so I can't just put it in fstab and use 'mount /media/cdrom' for both CD-R and RW discs.
Please try this patch.
Allow non-writable media to be mounted.
---
drivers/block/pktcdvd.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/block/pktcdvd.c +3 -4
@@ -1896,7 +1896,7 @@ static int pkt_open_write(struct pktcdvdif ((ret =pkt_probe_settings (pd))) {DPRINTK ("pktcdvd: %s failed probe\n" , pd->name); -return -EIO ; +return -EROFS ; }if ((ret =pkt_set_write_settings (pd))) {
@@ -2054,10 +2054,9 @@ static int pkt_open(struct inode *inode, goto out_dec; } }else { -if (pkt_open_dev (pd, file->f_mode &FMODE_WRITE )) { - ret = -EIO ; + ret =pkt_open_dev (pd, file->f_mode &FMODE_WRITE ); +if (ret) goto out_dec; - }/* * needed here as well, since ext2 (among others) may change * the blocksize at mount time
Signature · 2 lines
Peter Osterlund - [email protected] http://web.telia.com/~u89404340
Quoted 20 lines · Peter Osterlund
Quoted 18 lines · Damian Pietras
Quoted 16 lines · Peter Osterlund
The irq timeout problem might be broken hardware/firmware, but there is a problem with drive locking and the pktcdvd driver.
If you do
pktsetup 0
/dev/hdc
mount/dev/hdc/mnt/tmp
umount/mnt/tmpthe door will be left in a locked state. (It gets unlocked when you run "pktsetup -d 0" though.) However, if you do:
pktsetup 0
/dev/hdc
mount/dev/pktcdvd/0/mnt/tmp
umount/mnt/tmp
Quoted 8 lines
Quoted 6 lines
Thanks!
It works this way without any irq timeout. Unfortunately I can't use it as a workaround, because CD-R media must be mounted with '-o ro' or I get 'pktcdvd: Wrong disc profile (9)', so I can't just put it in fstab and use 'mount /media/cdrom' for both CD-R and RW discs.
Please try this patch.
Now I can mount CD-R, CD-RW, DVD+RW using pktcdvd.
Something strange happend when I copied files to DVD+RW und used eject. After some time eject exitet, but the disc was stil in the burner, I was allowed to open it by pressing the eject button, but then:
hda: media error (bad sector): status=0x51 { DriveReady SeekComplete Error }
hda: media error (bad sector): error=0x34 { AbortedCommand LastFailedSense=0x03 }
ide: failed opcode was: unknownend_request: I/O error, dev hda, sector 4546112end_request: I/O error, dev hda, sector 4546116end_request: I/O error, dev hda, sector 4546124end_request: I/O error, dev hda, sector 4546132end_request: I/O error, dev hda, sector 4546140end_request: I/O error, dev hda, sector 4546148end_request: I/O error, dev hda, sector 4546156end_request: I/O error, dev hda, sector 4546164end_request: I/O error, dev hda, sector 4546172
Buffer I/O error on device pktcdvd0, logical block 1136528
lost page write due to I/O error on pktcdvd0
And also many messages like this:
pktcdvd: Unknown ioctl for pktcdvd0 (5326)
I have no more free time to test if the disc is OK, but I think it is, since it's new and was written only few times.
Writing to CD-RW and umounting it gave no errors.
When inserting CD-R I get:
pktcdvd: Wrong disc profile (9)
pktcdvd: pktcdvd0 failed probe
but everything works OK.
Signature · 1 line
Damian Pietras
Quoted 8 lines · Damian Pietras
Now I can mount CD-R, CD-RW, DVD+RW using pktcdvd.
Something strange happend when I copied files to DVD+RW und used eject. After some time eject exitet, but the disc was stil in the burner, I was allowed to open it by pressing the eject button, but then:
hda: media error (bad sector): status=0x51 { DriveReady SeekComplete Error }
hda: media error (bad sector): error=0x34 { AbortedCommand LastFailedSense=0x03
Thanks for testing. Please try this patch: It makes sure not to unlock the door if the disc is in use.
drivers/block/pktcdvd.c +2 -1
@@ -2436,7 +2436,8 @@ static int pkt_ioctl(struct block_device* The door gets locked when the device is opened, so we * have to unlock it or else the eject command fails. */ -pkt_lock_door (pd,0 ); +if (pd->refcnt ==1 ) +pkt_lock_door (pd,0 );return blkdev_ioctl (pd->bdev, file, cmd, arg);default :
Quoted 8 lines
And also many messages like this:
pktcdvd: Unknown ioctl for pktcdvd0 (5326)When inserting CD-R I get:
pktcdvd: Wrong disc profile (9)
pktcdvd: pktcdvd0 failed probebut everything works OK.
Yes, those messages are quite useless except for debugging. I'll make them go away.
Signature · 2 lines
Peter Osterlund - [email protected] http://web.telia.com/~u89404340
Quoted 8 lines · Peter Osterlund
Quoted 6 lines · Damian Pietras
Now I can mount CD-R, CD-RW, DVD+RW using pktcdvd.
Something strange happend when I copied files to DVD+RW und used eject. After some time eject exitet, but the disc was stil in the burner, I was allowed to open it by pressing the eject button, but then:
Quoted 5 lines
Quoted 2 lines
hda: media error (bad sector): status=0x51 { DriveReady SeekComplete Error }
hda: media error (bad sector): error=0x34 { AbortedCommand LastFailedSense=0x03Thanks for testing. Please try this patch: It makes sure not to unlock the door if the disc is in use.
It still allows to eject the disc while umount /media/cdrom0 is waiting to finish.
Signature · 1 line
Damian Pietras
Quoted 9 lines · Damian Pietras
Quoted 8 lines · Peter Osterlund
Quoted 6 lines · Damian Pietras
Now I can mount CD-R, CD-RW, DVD+RW using pktcdvd.
Something strange happend when I copied files to DVD+RW und used eject. After some time eject exitet, but the disc was stil in the burner, I was allowed to open it by pressing the eject button, but then:
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
hda: media error (bad sector): status=0x51 { DriveReady SeekComplete Error }
hda: media error (bad sector): error=0x34 { AbortedCommand LastFailedSense=0x03Thanks for testing. Please try this patch: It makes sure not to unlock the door if the disc is in use.
It still allows to eject the disc while
umount /media/cdrom0is waiting to finish.
That patch was accidentally created on top of another patch which I haven't posted yet, so it didn't apply cleanly. Can you please try again with the patch below and 2.6.16-rc2-git10 or later?
If that still doesn't work as expected, how did you eject the disc? With the button or with the eject command? If it was the eject command, please run eject with strace and send the output to me.
pktcdvd: Don't unlock the door if the disc is in use
---
drivers/block/pktcdvd.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/block/pktcdvd.c +2 -1
@@ -2436,7 +2436,8 @@ static int pkt_ioctl(struct inode *inode* The door gets locked when the device is opened, so we * have to unlock it or else the eject command fails. */ -pkt_lock_door (pd,0 ); +if (pd->refcnt ==1 ) +pkt_lock_door (pd,0 );return blkdev_ioctl (pd->bdev->bd_inode, file, cmd, arg);default :
Signature · 2 lines
Peter Osterlund - [email protected] http://web.telia.com/~u89404340
Quoted 3 lines · Peter Osterlund
That patch was accidentally created on top of another patch which I haven't posted yet, so it didn't apply cleanly. Can you please try again with the patch below and 2.6.16-rc2-git10 or later?
Now it works properly, thanks.
Signature · 1 line
Damian Pietras
So mounting opens it in blocking mode, causing it to lock, but pktcdvd does not open it in blocking mode, so it doesn't get locked until the mount? Why does the cdrom driver differentiate between the two? Shouldn't it simply be locked when in use, no matter how it is used? And shouldn't pktcdvd explicitly unlock the drive when the pktcdvd device isn't open? For that matter, why is mount opening the cdrom in blocking mode? Shouldn't the filesystem be sending down async bios?
Quoted 23 lines · Peter Osterlund
If you do
pktsetup 0
/dev/hdc
mount/dev/hdc/mnt/tmp
umount/mnt/tmpthe door will be left in a locked state. (It gets unlocked when you run "pktsetup -d 0" though.) However, if you do:
pktsetup 0
/dev/hdc
mount/dev/pktcdvd/0/mnt/tmp
umount/mnt/tmpthe door will be properly unlocked.
The problem is that the cdrom driver locks the door the first time the device is opened in blocking mode, but doesn't unlock it again until the open count goes down to zero. The pktcdvd driver tries to work around that, but it can't do it in the first example because the mount/umount commands do not involve the pktcdvd driver at all.
On 15 Jan 2006, Peter Osterlund murmured:
Quoted 7 lines
If you do
pktsetup 0
/dev/hdc
mount/dev/hdc/mnt/tmp
umount/mnt/tmpthe door will be left in a locked state.
This is indeed what I see.
Quoted 5 lines
pktsetup 0
/dev/hdc
mount/dev/pktcdvd/0/mnt/tmp
umount/mnt/tmpthe door will be properly unlocked.
... and this.
... and my assumption that I couldn't mount non-packetwritten CDs via the /dev/pktcdvd/0 device is entirely erroneous. So it all works after all, as long as I never use the non-packetwritten device.
Oh *good*. Thank you for this: this was my last real thing that worked better in 2.4 than in 2.6 :)))
Quoted 5 lines
The problem is that the cdrom driver locks the door the first time the device is opened in blocking mode, but doesn't unlock it again until the open count goes down to zero. The pktcdvd driver tries to work around that, but it can't do it in the first example because the mount/umount commands do not involve the pktcdvd driver at all.
Yeah, well, it's obvious once you've explained it ;)
Signature · 2 lines
`Logic and human nature don't seem to mix very well, unfortunately.' --- Velvet Wood