Bug 2951

Summary: After mount/umount, cdrom won't eject or be opened by button
Product: IO/Storage Reporter: Cijoml Cijomlovic Cijomlov (cijoml)
Component: IDEAssignee: Borislav Petkov (bp)
Status: CLOSED CODE_FIX    
Severity: high CC: alan, axboe, devzero, dmiceman, giuliopaci, protasnb
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: all known 2.6.X, 2.4.X... - 2.6.22.6 Subsystem:
Regression: --- Bisected commit-id:

Description Cijoml Cijomlovic Cijomlov 2004-06-25 05:20:50 UTC
Distribution: Debian Woody
Hardware Environment: Acer TravelMate 242X
Software Environment: Linux vanilla-all versions
Problem Description:

PCI: Enabling device 00:1f.1 (0005 -> 0007)
ICH4: chipset revision 3
ICH4: not 100% native mode: will probe irqs later
    ide0: BM-DMA at 0x1810-0x1817, BIOS settings: hda:DMA, hdb:pio
    ide1: BM-DMA at 0x1818-0x181f, BIOS settings: hdc:DMA, hdd:pio
hda: IC25N020ATMR04-0, ATA DISK drive
blk: queue c034a0e0, I/O limit 4095Mb (mask 0xffffffff)
hdc: SR244W1, ATAPI CD/DVD-ROM drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
hda: attached ide-disk driver.
hda: host protected area => 1
hda: 39070080 sectors (20004 MB) w/1740KiB Cache, CHS=2432/255/63, UDMA(100)
Partition check:
 hda: hda1 hda2 hda3


This drive is from Mitsumi

Steps to reproduce:

mount cd, umount it. Then when pressed button on cdrom, cdrom is not opened.
When trying call eject, system tells:

eject /dev/hdc
eject: unable to eject, last error: Invalid argument
Comment 1 Cijoml Cijomlovic Cijomlov 2004-07-22 05:30:40 UTC
Hi,

any progress in this problem? :(
Comment 2 cyber_rigger 2004-09-17 12:08:26 UTC
I had a simmilar problem
Mine was a permissions problem

Do a
ls -l /dev/cdrom

Follow the symbolic links.
Check the permissions of the device it finally links to

I have a group called "cdrom"


I set my device to the group "cdrom""
with the permissions rw-rw----
and then I add cdrom users to this group

Make sure no one has the cdrom mounted
it won't open until everyone has unmounted.

Comment 3 Giulio Paci 2005-10-04 05:27:40 UTC
I had the same problem (mount /dev/hdc /cdrom; umount /cdrom; And then I cannot
eject without 1) eject from root or 2) reboot or 3) paperclip) on my laptop
(Toshiba M30-801), but only with the latest versions of the kernel.

I've tried these kernel version:
Unaffected: 2.6.5, 2.6.6, 2.6.7 (with and without pktcdvd patch),
Affected: 2.6.9, 2.6.10, 2.6.11, 2.6.13.2, 2.6.14-rc3

This is the relevant output of dmesg (in my opinion):
From Kernel 2.6.7 (Last kernel I tried where everithing worked) patched with
packetwrite support:
ide1: BM-DMA at 0x1848-0x184f, BIOS settings: hdc:DMA, hdd:pio
hdc: UJDA750 DVD/CDRW, ATAPI CD/DVD-ROM drive
hdc: ATAPI 24X DVD-ROM CD-R/RW drive, 2048kB Cache, UDMA(33)
pktcdvd: v0.1.5a 2004-06-26 Jens Axboe (axboe@suse.de) and petero2@telia.com
hdc: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
hdc: drive_cmd: error=0x04Aborted Command 
hdc: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
hdc: drive_cmd: error=0x04Aborted Command 
cdrom: This disc doesn't have any tracks I recognize!
pktcdvd: writer 0 mapped to hdc

From Kernel 2.6.14-rc3:
ide1: BM-DMA at 0x1848-0x184f, BIOS settings: hdc:DMA, hdd:pio
hdc: UJDA750 DVD/CDRW, ATAPI CD/DVD-ROM drive
hdc: ATAPI 24X DVD-ROM CD-R/RW drive, 2048kB Cache, UDMA(33)
pktcdvd: v0.2.0a 2004-07-14 Jens Axboe (axboe@suse.de) and petero2@telia.com
hdc: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
hdc: drive_cmd: error=0x04 { AbortedCommand }
ide: failed opcode was: 0xef
hdc: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
hdc: drive_cmd: error=0x04 { AbortedCommand }
ide: failed opcode was: 0xe3
cdrom: This disc doesn't have any tracks I recognize!
pktcdvd: writer pktcdvd0 mapped to hdc

program eject is using a deprecated SCSI ioctl, please convert it to SG_IO

Note that last line is displayed only after mount/umount.
When the line is displayed from dmesg, eject reports: "eject: unable to eject,
last error: Invalid argument".
If an user tries to eject a cdrom which has mounted and umounted, eject don't
eject the cdrom. But if root tries, the error messages are the same, but the
cdrom is ejected.
If an user tries to eject a cdrom which before mounting it, eject doesn't
display any error message and does his job. eject doesn't display any error
message and works good, even after a mounting/umounting problem, if root ejects
the cdrom, and then the cdrom is inserted again (but not mounted again):
ejection from root seems to reset the situation.
The button in front of the cd drive, have the same behaviour of eject (it stop
to work after a mount/umount, and restart to work after an ejection from root).
Comment 4 Giulio Paci 2006-02-03 19:29:14 UTC
Also new kernel versions (2.6.14 2.6.14.x 2.6.15)are affected.

I've found another way to restore the situation: from root running

# pktsetup -d /dev/pktcdvd/0

gives this error:
"ioctl: Inappropriate ioctl for device"

but then you can eject the cdrom without any other problem.

(/dev/pktcdvd/0 comes from:
# pktsetup /dev/pktcdvd/0 /dev/hdc
, where /dev/hdc is my cdrom)
Comment 5 Bartlomiej Zolnierkiewicz 2006-02-06 00:28:51 UTC
Jens, do you have any idea?
Comment 6 Giulio Paci 2006-02-06 07:19:27 UTC
By the way, when you use pktsetup dmesg output is:

pktcdvd: Unknown ioctl for pktcdvd0 (40045802)

Also I noticed that you don't need to be root to use this last trick: it works
for any user with read/write permission on the device.
Comment 7 David Walker 2006-04-10 12:28:41 UTC
Slackware 10.2, kernel.org kernel 2.6.16.1
DVD drive: 0,0,0     0) 'LITE-ON ' 'DVDRW SOHW-1633S' 'BS0C' Removable CD-ROM
(ATAPI drive)

I have experienced this problem also.

using eject-2.1.2 or eject-2.1.4, as root:
# mount /mnt/cdrom/
# umount /mnt/cdrom/
  umount command is optional, eject now unmounts, behaviour is the same with or
without it
  door button will not open door after umount
# ./eject /dev/hda
  door opens briefly and closes
  door button will now open door
# ./eject /dev/hda
  door opens
Comment 8 Burke Almquist 2006-05-22 14:51:48 UTC
I am having a similar problem on Slackware 10.2 with a complied 2.6.16.5 kernel. If i mount a cd AND try 
to copy a file from it to the disk I get a read error. I can then unmount the cdrom but cannot eject it. 
Trying to remount produces a kernel error that locks the terminal that I am in, but the other terms 2-6 are 
still responsive. Only rebooting will unlock the cdrom.
When I unloaded the nvidia binary module before mounting the cdrom everything works fine. So I'd guess 
this is an nvidia problem.
Comment 9 Giulio Paci 2006-08-11 19:12:30 UTC
Some news...

With newer kernels the "eject" trick works also for normal users, not only for root.

The problem seems to be related to packet writing: the problem exist only when
I've setted up device with pktsetup.
Comment 10 Dmitry Morozhnikov 2006-10-10 10:00:19 UTC
I also have this problem for last several minor versions of kernel, beginning
from 2.6.14 or 15, or 13, not sure, sorry :-( and to current 2.6.18. 

After inserting formatted dvdrw in my liteon sohw-1653 kernel being to write
something on it. I know that because corresponding LED is on and disk rotating.
Also it is impossible to get it back with eject (which produce no messages) or
device button -- only reboot helps. No messages in dmesg log too. Read-only
media and unformated dvdrw disks not cause such effects. Most important -- media
need not to be mounted to cause trouble. 

Device is working -- i checked it under windows after last reboot produced to
safe the disk.

I`m ready to help as much as possible to resolve this issue.
Comment 11 Alan 2007-09-10 09:02:01 UTC
This looks like the "failing command after close" thing Al Viro was poking at ?
Comment 12 Giulio Paci 2007-09-11 00:09:19 UTC
Hi! I've still the same hardware and the same problems. :-)
I'd like to answer Your question, but I cannot, since I don't know where to find information about the "failing command after close" thing You are talking about (Searching for "failing command after close" doesn't give me any hint)

Anyway my actual configuration is:
Debian Lenny, kernel vanilla 2.6.22.6, eject 2.1.5 by Jeff Tranter, udftools 1.0.0b3.
Comment 13 Giulio Paci 2007-09-11 00:09:39 UTC
Hi! I've still the same hardware and the same problems. :-)
I'd like to answer Your question, but I cannot, since I don't know where to find information about the "failing command after close" thing You are talking about (Searching for "failing command after close" doesn't give me any hint)

Anyway my actual configuration is:
Debian Lenny, kernel vanilla 2.6.22.6, eject 2.1.5 by Jeff Tranter, udftools 1.0.0b3.
Comment 14 Borislav Petkov 2008-02-20 08:13:08 UTC
Hi,

can anyone with the aforementioned problem test 2.6.25-rc2, please, to see whether the issue still exists?

Thanks,
Boris.
Comment 15 Roland Kletzing 2008-04-30 13:19:42 UTC
any news on this one?
Comment 16 Alan 2008-09-22 13:00:45 UTC
No responses so closing. If anyone can duplicate it with a current kernel please re-open