Subject: Re: VOP_RENAME
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 09/16/2002 12:01:36
On Mon, 16 Sep 2002, der Mouse wrote:

> In vnode_if.src, I see
>
> vop_rename {
> 	IN WILLRELE struct vnode *fdvp;
> 	IN WILLRELE struct vnode *fvp;
> 	IN struct componentname *fcnp;
> 	IN WILLPUT struct vnode *tdvp;
> 	IN WILLRELE struct vnode *tvp;
> 	IN struct componentname *tcnp;
> };
>
> but in ufs_rename, at the abortit: label, I see code that does
>
> 		if (tdvp == tvp)
> 			vrele(tdvp);
> 		else
> 			vput(tdvp);
> 		if (tvp)
> 			vput(tvp);
>
> which looks to me as though (a) tvp should be WILLPUT, not WILLRELE,
> and (b) the description language in vnode_if.src is too weak - there is
> no keyword for "WILLPUT unless equal to this other arg, in which case
> WILLRELE".  (vop_remove also, to my reading, should use this
> nonexistent code.)  There's also no keyword for "WILLPUT unless nil",
> which ISTM vop_rename should use on tvp and vnode_if.sh and
> genfs_eopnotsupp_rele should be made to understand.
>
> I conjecture that these have gone unnoticed because no filesystems use
> genfs_eopnotsupp_rele for the relevant calls, so the mis-descriptions
> have not actually affected anything.

Probably.

Note though that things like kernfs and procfs need to be able to do this
right, but since they don't hang onto vnodes, it doesn't seem to matter
much.

I want to get rid of all of the WILLRELE and the unlock stuff, but haven't
had time. PLEASE feel free to contribute code to do this (or borrow the
diffs FreeBSD did years ago to do this).

Take care,

Bill