Subject: Re: mount_mfs (with mount_null) won't reclaim space
To: David Laight <david@l8s.co.uk>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 03/19/2002 20:06:01
On Tue, 19 Mar 2002, David Laight wrote:

> >
> > Years ago, Perry bugged me for a document on the vnode locking protocol. I
> > probably should do it. :-)
>
> Is there any info lurking on what the vnode 'lock' actually covers?

Not really. To quote /sys/sys/vnode.h,

/*
 * Reading or writing any of these items requires holding the appropriate
lock.
 * v_freelist is locked by the global vnode_free_list simple lock.
 * v_mntvnodes is locked by the global mntvnodes simple lock.
 * v_flag, v_usecount, v_holdcount and v_writecount are
 *     locked by the v_interlock simple lock
 */

Everything else is covered by the overall vnode lock.

> I've a layered fs (that doesn't require any external support) I
> keep thinking of porting to netbsd (from SVR4MP).  It basically
> works by keeping reference counts on the lower vnodes - but SVR4
> only locks vnodes during read and write.

Netbsd does that too. /sys/kern/vnode.src documents the vnode locking
protocol. I'd need more info to say more, but so far nothing sound
undoable.

Take care,

Bill