[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: CD-ROM eject




> Hi,
> I have the following problem: ejecting the cdrom fails under KDE with
> "eject failed" message (no matter mounted or unmounted). The only way to
> remove the cd from the drive is to execute the eject command as root. Is
> there any way to fix it?
> When executing the eject command as root the following message is appear:
> "eject: unable to eject, last error: Invalid argument"
> Thanks in advance!

Are you running 2.6 kernel? Which version? Self-compiled or Debian?

This *may* be caused by a problem in 2.6 kernels (fixed in .10 or .11) with
scsi ioctls (although called scsi, these ioctls exist both for IDe and SCSI
devices). The problem was that issuing under user an ioctl which is allowed
only for rw-opened devices on ro-opened device resulted into overwrite of
in-kernel ioctl permission table, causing any futher calls to the same
ioctl as non-root to fail.

Main symptom of that problem was that writing CDs failed, and non-root
ejects on device on which a CD write was attempted also failed. 

Some time ago I applied the following patch to the kernel to fix the problem
(found somewhere in LKML and adopted to apply cleanly to what I had):

--- old/drivers/block/scsi_ioctl.c      2005-01-26 22:53:30.000000000 +0300
+++ new/drivers/block/scsi_ioctl.c      2005-01-26 22:53:36.000000000 +0300
@@ -197,10 +197,8 @@
        if (type & CMD_WRITE_SAFE) {
                if (file->f_mode & FMODE_WRITE)
                        return 0;
-       }
-
-       if (!(type & CMD_WARNED)) {
-               cmd_type[cmd[0]] = CMD_WARNED;
+       } else if (!(type & CMD_WARNED)) {
+               cmd_type[cmd[0]] |= CMD_WARNED;
                printk(KERN_WARNING "scsi: unknown opcode 0x%02x\n",cmd[0]);
        }

On newer kernels problem was fixed.
I don't remember if Debian kernel was affected.



Reply to: