Subject: Re: mount_mfs (with mount_null) won't reclaim space
To: enami tsugutomo <enami@sm.sony.co.jp>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 03/18/2002 18:03:24
On 19 Mar 2002, enami tsugutomo wrote:

> Bill Studenmund <wrstuden@netbsd.org> writes:
>
> > Well, that only fixes half of the problem. The problem is that vcount
> > doesn't understand layered vnodes. The half that remains is when you have
> > two file descriptors accessing an upper vnode and one of them calls
> > close(). The device will get closed even though there is still an active
> > user.
>
> What case do you imagine for example?  Two file descriptor open same
> layer fs vnode, or different layer fs vnode on different layer fs
> points same lower vnode?  Anyway, I don't think lower vnode's usecound
> drops before there is actual user.

Two file descriptors referencing the upper node, which in turn references
the lower node. The lower node will have one reference, so the hardware
close routine will get called when either one of the upper references'
close routine is called. And then it will get called again when the other
file descriptor is closed.

> > Fixing vcount() will need the exact same layering interconnect as we will
> > need to fix removal.
>
> Or, make layer fs cache to release lower vnode while it is cached but
> not used through the layer fs.

Releasing the lower vnode won't fix counting of upper references on the
stack (specifically the one above), and it can generate layering errors
(you can vget() the upper vnode w/o the file system code getting called,
so you can have an upper node in use w/o the lower vnode being activated).
So it looks like it has problems to me. It's probably ok to do for 1.6
(better than nothing), but the problems are still there.

Take care,

Bill