Subject: Re: /dev/stdout wierdness
To: =?iso-8859-1?Q?Jarom=EDr_Dolecek?= <jdolecek@netbsd.org>
From: Charles M. Hannum <root@ihack.net>
List: tech-userlevel
Date: 03/01/2001 12:50:43
On Thu, Mar 01, 2001 at 09:29:03PM +0100, Jaromír Dolecek wrote:
> Bill Studenmund wrote:
> > > Also one cosmetic - sys_fhopen() should call VOP_OPEN() _before_
> > > it checks O_TRUNC.
> > 
> > Why? sys_fhopen follows the exact same procedure as vn_open(), just w/o
> > the namei() calls & setup.
> > 
> > If we change vn_open(), then yes we should also change sys_fhopen(). But I
> > thought the discussion was talking about the fdesc filesystem instead. :-)
> 
> I think that the right fix to the problem is if fdesc would remove
> the O_TRUNC flag. For this to work properly, VOP_OPEN() has to be called
> before anything depending on O_TRUNC being set is executed.
> 
> Yeah, this means vn_open() needs to be changed too :)

The real problem here looks to me like: even though fdesc uses its own
shadow vnodes, it forwards getattr and setattr requests on to the
underlying vnode.  If we simply removed that garbage, the setattr would
fail in ~the same way it does in the non-fdesc case, and this problem
would go away.

I could almost -- ALMOST -- see a reason to swap the O_TRUNC and
VOP_OPEN() parts of vn_open(), but this sort of subtle semantic change
scares the Hell out of me.