Subject: vput vs vrele in vnodeops
To: None <tech-kern@netbsd.org>
From: Greg Troxel <gdt@ir.bbn.com>
List: tech-kern
Date: 04/06/2007 18:35:01
I'm trying to straighten out coda's vnodeops, and am confused by a
discrepancy between the documenation and code about handling dvp args in
a number of ops.

vnodeops(9) says:

     VOP_CREATE(dvp, vpp, cnp, vap)
              Create a new file in a given directory.  The argument dvp is the
              locked vnode of the directory to create the new file in and cnp
              is the pathname component of the new file.  The argument vap
              specifies the attributes that the new file should be created
              with.  If the file is successfully created, the address of the
              resulting locked vnode is returned in vpp and zero is returned.
              Regardless of the return value, the directory vnode dvp will be
              unlocked on return.

so I would think that the vnop implementation should do VOP_UNLOCK on
dvp.  But the coda coda does vput, and puffs does too.

I expected that the caller of VOP_CREATE would hold a ref, and that
VOP_CREATE would ride that ref, so it seems odd to release it.

What's the right behavior, and should vnodeops(9) be fixed?