Index: sys/fs/tmpfs/tmpfs_vnops.c =================================================================== --- sys/fs/tmpfs/tmpfs_vnops.c +++ sys/fs/tmpfs/tmpfs_vnops.c @@ -84,7 +84,8 @@ } static int -tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) +tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, + bool cached) { struct tmpfs_dirent *de; struct tmpfs_node *dnode, *pnode; @@ -94,10 +95,16 @@ dnode = VP_TO_TMPFS_DIR(dvp); *vpp = NULLVP; - /* Check accessibility of requested node as a first step. */ - error = vn_dir_check_exec(dvp, cnp); - if (error != 0) - goto out; + /* + * Check accessibility of requested node as a first step. If we are + * coming in via VOP_CACHEDLOOKUP, then this has already been done for + * us and we must not check again. + */ + if (!cached) { + error = vn_dir_check_exec(dvp, cnp); + if (error != 0) + goto out; + } /* We cannot be requesting the parent directory of the root node. */ MPASS(IMPLIES(dnode->tn_type == VDIR && @@ -235,14 +242,14 @@ tmpfs_cached_lookup(struct vop_cachedlookup_args *v) { - return (tmpfs_lookup1(v->a_dvp, v->a_vpp, v->a_cnp)); + return (tmpfs_lookup1(v->a_dvp, v->a_vpp, v->a_cnp, true)); } static int tmpfs_lookup(struct vop_lookup_args *v) { - return (tmpfs_lookup1(v->a_dvp, v->a_vpp, v->a_cnp)); + return (tmpfs_lookup1(v->a_dvp, v->a_vpp, v->a_cnp, false)); } static int