FreeBSD/sys/fs/unionfs/union_subr.c
/*
 * relookup for CREATE namei operation.
 *
 * dvp is unionfs vnode. dvp should be locked.
 *
 * If it called 'unionfs_copyfile' function by unionfs_link etc,
 * VOP_LOOKUP information is broken.
 * So it need relookup in order to create link etc.
 */
relookup for CREATE namei operation.
dvp is unionfs vnode. dvp should be locked.

If it called 'unionfs_copyfile' function by unionfs_link etc,
VOP_LOOKUP information is broken.
So it need relookup in order to create link etc.
relookup for CREATE namei operation . dvp is unionfs vnode . dvp should be locked . If it called ' unionfs_copyfile ' function by unionfs_link etc VOP_LOOKUP information is broken . So it need relookup in order to create link etc .
int
unionfs_relookup_for_create(struct vnode *dvp, struct componentname *cnp,
			    struct thread *td)
{
	int	error;
	struct vnode *udvp;
	struct vnode *vp;
	struct componentname cn;
	udvp = UNIONFSVPTOUPPERVP(dvp);
	vp = NULLVP;
	error = unionfs_relookup(udvp, &vp, cnp, &cn, td, cnp->cn_nameptr,
	    strlen(cnp->cn_nameptr), CREATE);
	if (error)
		return (error);
	if (vp != NULLVP) {
		if (udvp == vp)
			vrele(vp);
		else
			vput(vp);
		error = EEXIST;
	}
	if (cn.cn_flags & HASBUF) {
		uma_zfree(namei_zone, cn.cn_pnbuf);
		cn.cn_flags &= ~HASBUF;
	}
	if (!error) {
		cn.cn_flags |= (cnp->cn_flags & HASBUF);
		cnp->cn_flags = cn.cn_flags;
	}
	return (error);
}
int unionfs_relookup_for_create ( struct vnode * dvp , struct componentname * cnp , struct thread * td ) { int error ; struct vnode * udvp ; struct vnode * vp ; struct componentname cn ; udvp = UNIONFSVPTOUPPERVP ( dvp ) ; vp = NULLVP ; error = unionfs_relookup ( udvp , & vp , cnp , & cn , td , cnp -> cn_nameptr , strlen ( cnp -> cn_nameptr ) , CREATE ) ; if ( error ) return ( error ) ; if ( vp != NULLVP ) { if ( udvp == vp ) vrele ( vp ) ; else vput ( vp ) ; error = EEXIST ; } if ( cn . cn_flags & HASBUF ) { uma_zfree ( namei_zone , cn . cn_pnbuf ) ; cn . cn_flags &= ~ HASBUF ; } if ( ! error ) { cn . cn_flags |= ( cnp -> cn_flags & HASBUF ) ; cnp -> cn_flags = cn . cn_flags ; } return ( error ) ; }
relookup for CREATE namei operation.
relookup for CREATE namei operation .