Subject: Re: CVS commit: syssrc/sys/miscfs/nullfs
To: enami tsugutomo <enami@but-b.or.jp>
From: Bill Studenmund <wrstuden@wasabisystems.com>
List: source-changes
Date: 03/16/2002 20:53:29
On 17 Mar 2002, enami tsugutomo wrote:

> Bill Studenmund <wrstuden@wasabisystems.com> writes:
>
> > We probably could do something with v_id, but I think it would just
> > be easier to hang onto the reference.  We definitly want to hold the
> > reference while we are using the upper vnode.  So either we hold it
> > all the time, or we grab it & release it & grab it & release it. The
> > latter seems computationally intensive, since (with VOP_UPCALL or
> > whatever we end up doing) we can know when we need to do something.
>
> Yes, we need to reference lower vnode while we're USING it.  Having
> reference while we are keeping it while we're caching isn't so easy,
> since it makes us to address some issue.  For example, having
> reference means device close routine won't be called.  This was
> another issue due to we hold reference while upper vnode is cached.

That's why we don't cache device nodes. :-)

> And I think keeping reference of lower vnode means it will remain in
> the lower file system's cache longer than others.  It sounds not fair.

I can see a case where we stop using a layered vnode, then stop using a
vnode on the lower fs, then reuse (reclaim) the layered vnode thus putting
the lower one on the free list. We will reuse the lower vnode that wasn't
layered before the one that was, even though activity stopped on it later.

But we can address this issue, if we want, by arranging for that vnode to
go on the front of the free list rather than the end.

> If lower vnode is found in lower file system's cache, releasing &
> grabing shouldn't be so expensive.

But why?  Why release and grab every time we go on or off the free list,
when the times it matters (deletion below for instance) are rare, and
well-defined?

Think about a case where someone has a web server in a chroot environment,
and they have read-only null mounted the content into the chroot. Each web
page is going to result in a path lookup. All of the directories traversed
in finding a file will come into use (come off of free list), be used for
a lookup, and then go out of use (go back on the free list). If we don't
hang onto a ref on the lower vnode, each lookup now has to do a
reactivate. That seems wasteful to me.

Take care,

Bill