diff -urBN /usr/src.orig/sys/fs/unionfs/union_vnops.c /usr/src/sys/fs/unionfs/union_vnops.c --- /usr/src.orig/sys/fs/unionfs/union_vnops.c Sun Feb 4 22:49:14 2007 +++ /usr/src/sys/fs/unionfs/union_vnops.c Sun Feb 4 22:55:27 2007 @@ -88,7 +88,7 @@ static int -unionfs_lookup(struct vop_lookup_args *ap) +unionfs_lookup(struct vop_cachedlookup_args *ap) { int iswhiteout; int lockflag; @@ -171,7 +171,9 @@ vn_lock(dunp->un_dvp, cnp->cn_lkflags | LK_RETRY, td); vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td); - } + } else if (error == ENOENT && (cnflags & MAKEENTRY) && + nameiop != CREATE) + cache_enter(dvp, NULLVP, cnp); UNIONFS_INTERNAL_DEBUG("unionfs_lookup: leave (%d)\n", error); @@ -318,12 +320,18 @@ *(ap->a_vpp) = vp; + if (cnflags & MAKEENTRY) + cache_enter(dvp, vp, cnp); + unionfs_lookup_out: if (uvp != NULLVP) vrele(uvp); if (lvp != NULLVP) vrele(lvp); + if (error == ENOENT && (cnflags & MAKEENTRY) && nameiop != CREATE) + cache_enter(dvp, NULLVP, cnp); + UNIONFS_INTERNAL_DEBUG("unionfs_lookup: leave (%d)\n", error); return (error); @@ -1179,6 +1187,13 @@ error = VOP_RENAME(rfdvp, rfvp, fcnp, rtdvp, rtvp, tcnp); + if (error == 0) { + if (rtvp != NULLVP && rtvp->v_type == VDIR) + cache_purge(tdvp); + if (fvp->v_type == VDIR && fdvp != tdvp) + cache_purge(fdvp); + } + if (fdvp != rfdvp) vrele(fdvp); if (fvp != rfvp) @@ -1311,6 +1326,11 @@ else if (lvp != NULLVP) error = unionfs_mkwhiteout(udvp, cnp, td, unp->un_path); + if (error == 0) { + cache_purge(ap->a_dvp); + cache_purge(ap->a_vp); + } + UNIONFS_INTERNAL_DEBUG("unionfs_rmdir: leave (%d)\n", error); return (error); @@ -2234,6 +2254,7 @@ .vop_aclcheck = unionfs_aclcheck, .vop_advlock = unionfs_advlock, .vop_bmap = VOP_EOPNOTSUPP, + .vop_cachedlookup = unionfs_lookup, .vop_close = unionfs_close, .vop_closeextattr = unionfs_closeextattr, .vop_create = unionfs_create, @@ -2249,7 +2270,7 @@ .vop_link = unionfs_link, .vop_listextattr = unionfs_listextattr, .vop_lock = unionfs_lock, - .vop_lookup = unionfs_lookup, + .vop_lookup = vfs_cache_lookup, .vop_mkdir = unionfs_mkdir, .vop_mknod = unionfs_mknod, .vop_open = unionfs_open,