FreeBSD/sys/fs/unionfs/union_subr.c
/*
 * Update the unionfs_node.
 * 
 * uvp is new locked upper vnode. unionfs vnode's lock will be exchanged to the
 * uvp's lock and lower's lock will be unlocked.
 */


uvp is new locked upper vnode. unionfs vnode's lock will be exchanged to the
uvp's lock and lower's lock will be unlocked.
uvp is new locked upper vnode . unionfs vnode ' s lock will be exchanged to the uvp ' s lock and lower ' s lock will be unlocked .
static void
unionfs_node_update(struct unionfs_node *unp, struct vnode *uvp,
		    struct thread *td)
{
	unsigned	count, lockrec;
	struct vnode   *vp;
	struct vnode   *lvp;
	struct vnode   *dvp;
	vp = UNIONFSTOV(unp);
	lvp = unp->un_lowervp;
	ASSERT_VOP_ELOCKED(lvp, "unionfs_node_update");
	dvp = unp->un_dvp;
	VI_LOCK(vp);
	unp->un_uppervp = uvp;
	vp->v_vnlock = uvp->v_vnlock;
	VI_UNLOCK(vp);
	lockrec = lvp->v_vnlock->lk_recurse;
	for (count = 0; count < lockrec; count++)
		vn_lock(uvp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY);
	if (unp->un_path != NULL && dvp != NULLVP && vp->v_type == VDIR) {
		static struct unionfs_node_hashhead *hd;
		VI_LOCK(dvp);
		hd = unionfs_get_hashhead(dvp, unp->un_path);
		LIST_REMOVE(unp, un_hash);
		LIST_INSERT_HEAD(hd, unp, un_hash);
		VI_UNLOCK(dvp);
	}
}
static void unionfs_node_update ( struct unionfs_node * unp , struct vnode * uvp , struct thread * td ) { unsigned count , lockrec ; struct vnode * vp ; struct vnode * lvp ; struct vnode * dvp ; vp = UNIONFSTOV ( unp ) ; lvp = unp -> un_lowervp ; ASSERT_VOP_ELOCKED ( lvp , " " ) ; dvp = unp -> un_dvp ; VI_LOCK ( vp ) ; unp -> un_uppervp = uvp ; vp -> v_vnlock = uvp -> v_vnlock ; VI_UNLOCK ( vp ) ; lockrec = lvp -> v_vnlock -> lk_recurse ; for ( count = 0 ; count < lockrec ; count ++ ) vn_lock ( uvp , LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY ) ; if ( unp -> un_path != NULL && dvp != NULLVP && vp -> v_type == VDIR ) { static struct unionfs_node_hashhead * hd ; VI_LOCK ( dvp ) ; hd = unionfs_get_hashhead ( dvp , unp -> un_path ) ; LIST_REMOVE ( unp , un_hash ) ; LIST_INSERT_HEAD ( hd , unp , un_hash ) ; VI_UNLOCK ( dvp ) ; } }
Update the unionfs_node.
Update the unionfs_node .
/*
	 * lock update
	 */ /*
	 * cache update
	 */