Date: Sun, 21 Dec 2014 13:29:34 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276007 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/ext2fs fs/msdosfs fs/nandfs fs/tmpfs ufs/ufs Message-ID: <201412211329.sBLDTYal026700@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sun Dec 21 13:29:33 2014 New Revision: 276007 URL: https://svnweb.freebsd.org/changeset/base/276007 Log: Handle MAKEENTRY cnp flag in the VOP_CREATE(). Curiously, some fs, e.g. smbfs, already did it. Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/fs/ext2fs/ext2_vnops.c head/sys/fs/msdosfs/msdosfs_vnops.c head/sys/fs/nandfs/nandfs_vnops.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Dec 21 12:36:36 2014 (r276006) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Dec 21 13:29:33 2014 (r276007) @@ -6180,15 +6180,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 Modified: head/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vnops.c Sun Dec 21 12:36:36 2014 (r276006) +++ head/sys/fs/ext2fs/ext2_vnops.c Sun Dec 21 13:29:33 2014 (r276007) @@ -239,8 +239,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); } Modified: head/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vnops.c Sun Dec 21 12:36:36 2014 (r276006) +++ head/sys/fs/msdosfs/msdosfs_vnops.c Sun Dec 21 13:29:33 2014 (r276007) @@ -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: Modified: head/sys/fs/nandfs/nandfs_vnops.c ============================================================================== --- head/sys/fs/nandfs/nandfs_vnops.c Sun Dec 21 12:36:36 2014 (r276006) +++ head/sys/fs/nandfs/nandfs_vnops.c Sun Dec 21 13:29:33 2014 (r276007) @@ -1411,6 +1411,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)); Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 21 12:36:36 2014 (r276006) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 21 13:29:33 2014 (r276007) @@ -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 Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Sun Dec 21 12:36:36 2014 (r276006) +++ head/sys/ufs/ufs/ufs_vnops.c Sun Dec 21 13:29:33 2014 (r276007) @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412211329.sBLDTYal026700>