Subject: Re: cd(4) and xmcd
To: Greywolf <greywolf@starwolf.com>
From: Bill Studenmund <wrstuden@nas.nasa.gov>
List: current-users
Date: 02/18/2000 16:51:35
On Tue, 15 Feb 2000, Greywolf wrote:

> On Tue, 15 Feb 2000, Peter Seebach wrote:
> 
> #	When a CD-ROM is changed in a drive controlled by the cd driver,
> #	then the act of changing the media will invalidate the disklabel
> #	and information held within the kernel.  To stop corruption...
> 
> ...excuse me.  Hello?  CD-ROM?  ...ROM?  as in READ-ONLY MEMORY?
> WHAT corruption?

As others have said, it's not corruption of the data on the disk, but
corruption of the internal kernel state of what's on the disk.

> #	all
> #	accesses to the device will be discarded until there are no more
> #	open file descriptors referencing the device.
> 
> This is broken.  Why doesn't the access return EBADF instead of being
> "discarded" (i.e. CLOSE the damn descriptors)?  And if it's bound to the
> device, why does it not just flush the data cache associated therewith, if
> applicable (which I don't think it is, but hey...)?

Because filesystems keep state in internal structures and won't notice
this change. The only thing to do is blow all current accesses away.

What it probably is doing is blowing away the device vnodes assosciated
with the device. they will then become dead vnodes, and most opperations
will return errors. As subsystems which were using the nodes notice the
errors, they will close, and reference counts will drop. Finally the vnode
will be unused, and get recycled. :-)

Take care,

Bill