diff options
author | kib <kib@FreeBSD.org> | 2015-01-04 00:46:06 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-01-04 00:46:06 +0000 |
commit | 511130787fe28fb9da8b2e64c39d0bc3742b9eff (patch) | |
tree | 1a3c2378ff40eaf9fc2c05de98b60d68f9001074 | |
parent | 109bfbf650e0280709d4219ab02f754fa6e51a44 (diff) | |
download | FreeBSD-src-511130787fe28fb9da8b2e64c39d0bc3742b9eff.zip FreeBSD-src-511130787fe28fb9da8b2e64c39d0bc3742b9eff.tar.gz |
MFC r276007:
Handle MAKEENTRY cnp flag in the VOP_CREATE().
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 11 | ||||
-rw-r--r-- | sys/fs/ext2fs/ext2_vnops.c | 4 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vnops.c | 2 | ||||
-rw-r--r-- | sys/fs/nandfs/nandfs_vnops.c | 2 | ||||
-rw-r--r-- | sys/fs/tmpfs/tmpfs_vnops.c | 6 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 4 |
6 files changed, 23 insertions, 6 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index 8c3a910..6749e9f 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -6155,15 +6155,20 @@ zfs_freebsd_create(ap) { struct componentname *cnp = ap->a_cnp; vattr_t *vap = ap->a_vap; - int mode; + int error, mode; ASSERT(cnp->cn_flags & SAVENAME); vattr_init_mask(vap); mode = vap->va_mode & ALLPERMS; - return (zfs_create(ap->a_dvp, cnp->cn_nameptr, vap, !EXCL, mode, - ap->a_vpp, cnp->cn_cred, cnp->cn_thread)); + error = zfs_create(ap->a_dvp, cnp->cn_nameptr, vap, !EXCL, mode, + ap->a_vpp, cnp->cn_cred, cnp->cn_thread); +#ifdef FREEBSD_NAMECACHE + if (error == 0 && (cnp->cn_flags & MAKEENTRY) != 0) + cache_enter(ap->a_dvp, *ap->a_vpp, cnp); +#endif + return (error); } static int diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c index b25e385..719d57a 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -240,8 +240,10 @@ ext2_create(struct vop_create_args *ap) error = ext2_makeinode(MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode), ap->a_dvp, ap->a_vpp, ap->a_cnp); - if (error) + if (error != 0) return (error); + if ((ap->a_cnp->cn_flags & MAKEENTRY) != 0) + cache_enter(ap->a_dvp, *ap->a_vpp, ap->a_cnp); return (0); } diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index a60fa13..3294656 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -184,6 +184,8 @@ msdosfs_create(ap) if (error) goto bad; *ap->a_vpp = DETOV(dep); + if ((cnp->cn_flags & MAKEENTRY) != 0) + cache_enter(ap->a_dvp, *ap->a_vpp, cnp); return (0); bad: diff --git a/sys/fs/nandfs/nandfs_vnops.c b/sys/fs/nandfs/nandfs_vnops.c index 78776f0..ed39b39 100644 --- a/sys/fs/nandfs/nandfs_vnops.c +++ b/sys/fs/nandfs/nandfs_vnops.c @@ -1414,6 +1414,8 @@ nandfs_create(struct vop_create_args *ap) return (error); } *vpp = NTOV(node); + if ((cnp->cn_flags & MAKEENTRY) != 0) + cache_enter(dvp, *vpp, cnp); DPRINTF(VNCALL, ("created file vp %p nandnode %p ino %jx\n", *vpp, node, (uintmax_t)node->nn_ino)); diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 29ee389..c811b9a 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -213,10 +213,14 @@ tmpfs_create(struct vop_create_args *v) struct vnode **vpp = v->a_vpp; struct componentname *cnp = v->a_cnp; struct vattr *vap = v->a_vap; + int error; MPASS(vap->va_type == VREG || vap->va_type == VSOCK); - return tmpfs_alloc_file(dvp, vpp, vap, cnp, NULL); + error = tmpfs_alloc_file(dvp, vpp, vap, cnp, NULL); + if (error == 0 && (cnp->cn_flags & MAKEENTRY) != 0) + cache_enter(dvp, *vpp, cnp); + return (error); } static int diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 79238d1..5a38114 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -205,8 +205,10 @@ ufs_create(ap) error = ufs_makeinode(MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode), ap->a_dvp, ap->a_vpp, ap->a_cnp); - if (error) + if (error != 0) return (error); + if ((ap->a_cnp->cn_flags & MAKEENTRY) != 0) + cache_enter(ap->a_dvp, *ap->a_vpp, ap->a_cnp); return (0); } |