mounted cd and tray locking

Nikos Vassiliadis nvass at
Thu Dec 13 03:08:48 PST 2007

On Thursday 13 December 2007 12:28:39 Andriy Gapon wrote:
> on 13/12/2007 12:13 Nikos Vassiliadis said the following:
> > On Thursday 13 December 2007 11:42:00 Andriy Gapon wrote:
> >> on 13/12/2007 09:30 Nikos Vassiliadis said the following:
> >>> On Wednesday 12 December 2007 18:58:44 Andriy Gapon wrote:
> >>>> Hmm. Looked at the code and it should be as expected. Played with
> >>>> various stuff and here's what I think: it seems that having
> >>>> atapicam and hald and maybe something in KDE that polls for CD
> >>>> change is to blame.
> >>>
> >>> I have no atapicam in my kernel. Nor hald running.
> >>> I reproduced it like this:
> >>> mount /cdrom
> >>> cdcontrol eject
> >>
> >> I don't think you reproduced it. Why would you execute the above
> >> command unless it is your intention to eject the disk ?
> >
> > You got it wrong. cdcontrol *does not* eject the disk, it works
> > correctly, as it should. cdcontrol never ejects mounted media.
> Well, I got it right, it's just that in my opinion you knew what you
> were doing.

Thanks for the wording...

> > It triggers the situation where I can then press the eject key
> > on the cdrom and really eject the cdrom.
> It would be interesting to see what exact ioctls/commands cdcontrol
> issues. ktrace+kdump can help with this. Assuming your drive is ATAPI
> (not SCSI) then if only CDIOCEJECT is issued then the drive should not
> become unlocked.

How can this be interesting?
cdcontrol does not open the tray. cdcontrol gets an EBUSY and exits.
The button does. So, it seems to the - naive - me that the error is
somewhere in the kernel.

> > Nevertheless ejecting a mounted medium is wrong. And that's not
> > a feature. This is obviously a problem, regardless of how you
> > trigger it. Would you like to file a PR?
> Well, I see your point and probably I would agree 80% with you :-)
> But this issue seems to be a little bit different from the issue that
> concerns me most (which I explained in another email).
> Someone could reply to your problem with that old joke:
> - Doctor, it hurts when I do this.
> - Then don't do it.

I believe that the "old joke" doesn't apply here.
I will file a PR when I'll have available time.


More information about the freebsd-questions mailing list