Subject: Re: making all fd's point at vnodes?
To: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
From: Bill Studenmund <wrstuden@zembu.com>
List: tech-kern
Date: 06/18/2001 11:24:57
On Mon, 18 Jun 2001, Bill Sommerfeld wrote:

> > So we'd be changing the locking semantics of VOP_READ & VOP_WRITE? I don't
> > think that's a good idea. If we put "vnodes" into file descriptors, I
> > think we should just put the locking there too. (sockets and pipes can
> > have nops for lock/unlock routines)
> 
> nop's still have a cost; if only filesystem vnodes need VOP_LOCK, then
> only filesystem vnodes should pay the cost.

That's ok. Maybe have an fd flag which says, "do locking." We set/don't
set it at fd creation (a point at which we know if we have an fs vnode
there or not).

But making VOP_READ and VOP_WRITE callable with an unlocked vnode strikes
me as a VERY bad idea. One of the things which made doing layered file
systems easier was getting strict about vnode locking - always lock the
vnode, and don't change the node's state during a call (or if you do, put
it back the way it was, i.e. the VRELE VOPs are bad).

As I understand your suggestion, we'd be muddying the waters - you'd have
to look in a flag to know if the vnode is locked. That would make life
more of a mess for layered file systems.

Take care,

Bill