From obrien@dragon.nuxi.com  Sun Nov 23 16:53:24 1997
Received: from relay.nuxi.com (nuxi.cs.ucdavis.edu [128.120.56.38])
          by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id QAA18635
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 23 Nov 1997 16:53:13 -0800 (PST)
          (envelope-from obrien@dragon.nuxi.com)
Received: from dragon.nuxi.com (d60-090.leach.ucdavis.edu [169.237.60.90]) by relay.nuxi.com (8.8.7/8.6.12) with ESMTP id QAA08213 for <FreeBSD-gnats-submit@freebsd.org>; Sun, 23 Nov 1997 16:53:09 -0800 (PST)
Received: (from obrien@localhost) by dragon.nuxi.com (8.8.7/8.7.3) id AAA00454; Mon, 24 Nov 1997 00:52:56 GMT
Message-Id: <199711240052.AAA00454@dragon.nuxi.com>
Date: Mon, 24 Nov 1997 00:52:56 GMT
From: "David O'Brien" <obrien@NUXI.com>
Reply-To: obrien@NUXI.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: cdcontrol will eject a mounted CDROM
X-Send-Pr-Version: 3.2

>Number:         5134
>Category:       bin
>Synopsis:       cdcontrol will eject a mounted CDROM
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 23 17:00:02 PST 1997
>Closed-Date:    Tue May 29 12:06:35 PDT 2001
>Last-Modified:  Tue May 29 12:06:56 PDT 2001
>Originator:     David O'Brien
>Release:        FreeBSD 2.2.5-STABLE i386
>Organization:
The FreeBSD Project
>Environment:

	2.2.5-STABLE kernel from Nov 22.
	2.2.5-STABLE binaries from Nov 1.

>Description:

	I forgot to umount my mounted CDROM before issueing an "eject" command
	(have aliases called ``eject'').  Put in new CDROM.  Things get screwy
	from there.

	Should cdcontrol really be able to eject a CDROM from a single cdrom
	drive?

>How-To-Repeat:

	Insert a CDROM into your SCSI cdrom drive.
	mount_cd9660 /dev/cd0a /cdrom
	/usr/sbin/cdcontrol eject
	Insert a different CDROM into your cdrom drive
	## OPPS! forgot to umount it first
	umount /cdrom

	BANG!  reboot.

>Fix:
	
	

>Release-Note:
>Audit-Trail:

From: j@uriah.heep.sax.de (J Wunsch)
To: obrien@NUXI.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/5134: cdcontrol will eject a mounted CDROM
Date: Mon, 24 Nov 1997 08:38:51 +0100

 As David O'Brien wrote:
 
 > 	Should cdcontrol really be able to eject a CDROM from a single cdrom
 > 	drive?
 
 It most likely should not, but you gotta fix all the broken ports
 first that rely on this behaviour, and wanna eject a CD while keeping
 a file descriptor open on it.  If it weren't for this, i would
 probably have fixed this long ago.
 
 I'm afraid doing it right will require a control device (but a
 different one than rcd0.ctl), so you can tell: ``Well, even though i'm
 keeping this descriptor open, i don't wanna do data IO through it.''
 This would also come handy to supress the useless `media not present'
 warnings once you've hit the eject button e.g. in workman.
 
 -- 
 cheers, J"org
 
 joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
 Never trust an operating system you don't have sources for. ;-)

From: Thomas David Rivers <rivers@dignus.com>
To: freebsd-bugs@freefall.freebsd.org, obrien@nuxi.com
Cc:  Subject: Re: bin/5134: cdcontrol will eject a mounted CDROM
Date: Wed, 21 Jan 1998 08:05:00 PST

 I'd like to add another data point to this tracking entry.
 
 On one of my machines, I have a NEC CDROM that looks a lot like
 a typical "walkman" (i.e. it has a flip-top lid you can open at
 any time.)
 
 If I mount a CDROM, open the lid, close the lid and then try
 to mount the CDROM (note - no unmount) - the system reboots.
 
 You might be able to duplicate this behaviour by simply trying to
 mount a SCSI cdrom before unmounting it...  I haven't checked that.
 
 This is 2.2.5-RELEASE.
 
 	- Dave Rivers -

From: Stefan Eggers <seggers@semyam.dinoco.de>
To: freebsd-gnats-submit@freebsd.org, obrien@NUXI.com
Cc: seggers@semyam.dinoco.de
Subject: Re: bin/5134: cdcontrol will eject a mounted CDROM
Date: Mon, 15 Jun 1998 20:17:46 +0200

 Quote from the report:
 
 	Insert a CDROM into your SCSI cdrom drive.
 	mount_cd9660 /dev/cd0a /cdrom
 	/usr/sbin/cdcontrol eject
 	Insert a different CDROM into your cdrom drive
 	## OPPS! forgot to umount it first
 	umount /cdrom
 
 	BANG!  reboot.
 
 I did something similar.  I had a CD mounted and at the same time xmcd
 was running waiting for an audio CD.
 
 The interesting part is that I have xmcd configured to unlock the tray
 and it did this though the CD was mounted.  I opened it by accident,
 saw what I did and closed it again.
 
 Before the drive recognized that I inserted a CD (my 12x SCSI CD drive
 takes some time for this) I did an unmount on it and got a panic.
 
 To get a useful message for the problem report I did it again but this
 time I made sure that I had the console in front of me at the time of
 the panic instead of the X11 screen.  Thus I read:
 
    panic: vref used where vget required
 
 Maybe someone has an idea what went wrong or even how to prevent this
 from happening.
 
 Stefan.

From: Stefan Eggers <seggers@semyam.dinoco.de>
To: freebsd-gnats-submit@freebsd.org, obrien@NUXI.com
Cc: seggers@semyam.dinoco.de
Subject: Re: bin/5134: cdcontrol will eject a mounted CDROM 
Date: Thu, 18 Jun 1998 11:53:25 +0200

 As it is kern and not bin and the subject is too misleading I think
 a separate problem report is a good idea.  I file one after finishing
 this reply.
 
 The problem of ejecting a mounted CD-ROM with cdcontrol is still
 one I think.  Even w/o a panic it can cause enough trouble.  So
 this PR still has a reason to live on.
 
 > I did something similar.  I had a CD mounted and at the same time xmcd
 > was running waiting for an audio CD.
 > 
 > The interesting part is that I have xmcd configured to unlock the tray
 > and it did this though the CD was mounted.  I opened it by accident,
 > saw what I did and closed it again.
 > 
 > Before the drive recognized that I inserted a CD (my 12x SCSI CD drive
 > takes some time for this) I did an unmount on it and got a panic.
 
 I did some investigation and an experiment.  The panic only shows
 up when I do not access the CD's directory.  If I do an "ls" before
 eject with unmount everything is fine.
 
 So I took a look at the locking operations the cd9660 file system
 does on inodes and vnodes as my thought was that the accesses to
 some directory or file will probably lock the node and thus then
 the VREF() is legal.  W/o the lookup the node is as unlocked as
 when it was created.  Trying a VREF() on it will cause the panic.
 
 I didn't understand it, yet (only looked at it for a few minutes)
 but it seems as if the name lookup in cd9660_lookup.c locks them
 on its way down but does not unlock them.  That would explain why
 a simple "ls" on the CD-ROM prevented the panic.  It was locked by
 the lookup already.
 
 Stefan.
State-Changed-From-To: open->closed 
State-Changed-By: sos 
State-Changed-When: Tue May 29 12:06:35 PDT 2001 
State-Changed-Why:  
Obsolete. 


http://www.FreeBSD.org/cgi/query-pr.cgi?pr=5134 
>Unformatted:
