Date: Thu, 1 Jan 2015 10:44:21 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r276500 - in stable/10/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/ext2fs fs/fuse fs/msdosfs fs/nandfs fs/nfsclient fs/nfsserver fs/tmpfs fs/unionfs kern nfsclient nfsserver ufs/... Message-ID: <201501011044.t01AiLDp050836@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Thu Jan 1 10:44:20 2015 New Revision: 276500 URL: https://svnweb.freebsd.org/changeset/base/276500 Log: MFC r275897: Set NOCACHE flag for CREATE namei() calls, do not specially handle MAKEENTRY in VOP_LOOKUP(). Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/10/sys/fs/ext2fs/ext2_lookup.c stable/10/sys/fs/fuse/fuse_vnops.c stable/10/sys/fs/msdosfs/msdosfs_lookup.c stable/10/sys/fs/nandfs/nandfs_vnops.c stable/10/sys/fs/nfsclient/nfs_clvnops.c stable/10/sys/fs/nfsserver/nfs_nfsdserv.c stable/10/sys/fs/tmpfs/tmpfs_vnops.c stable/10/sys/fs/unionfs/union_subr.c stable/10/sys/fs/unionfs/union_vnops.c stable/10/sys/kern/uipc_usrreq.c stable/10/sys/kern/vfs_syscalls.c stable/10/sys/kern/vfs_vnops.c stable/10/sys/nfsclient/nfs_vnops.c stable/10/sys/nfsserver/nfs_serv.c stable/10/sys/ufs/ffs/ffs_snapshot.c stable/10/sys/ufs/ufs/ufs_lookup.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 1 10:44:20 2015 (r276500) @@ -1538,7 +1538,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode /* * Insert name into cache (as non-existent) if appropriate. */ - if (error == ENOENT && (cnp->cn_flags & MAKEENTRY) && nameiop != CREATE) + if (error == ENOENT && (cnp->cn_flags & MAKEENTRY) != 0) cache_enter(dvp, *vpp, cnp); /* * Insert name into cache if appropriate. Modified: stable/10/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- stable/10/sys/fs/ext2fs/ext2_lookup.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/fs/ext2fs/ext2_lookup.c Thu Jan 1 10:44:20 2015 (r276500) @@ -514,7 +514,7 @@ notfound: /* * Insert name into cache (as non-existent) if appropriate. */ - if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE) + if ((cnp->cn_flags & MAKEENTRY) != 0) cache_enter(vdp, NULL, cnp); return (ENOENT); Modified: stable/10/sys/fs/fuse/fuse_vnops.c ============================================================================== --- stable/10/sys/fs/fuse/fuse_vnops.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/fs/fuse/fuse_vnops.c Thu Jan 1 10:44:20 2015 (r276500) @@ -795,7 +795,7 @@ calldaemon: * caching...) */ #if 0 - if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE) { + if ((cnp->cn_flags & MAKEENTRY) != 0) { FS_DEBUG("inserting NULL into cache\n"); cache_enter(dvp, NULL, cnp); } Modified: stable/10/sys/fs/msdosfs/msdosfs_lookup.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_lookup.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/fs/msdosfs/msdosfs_lookup.c Thu Jan 1 10:44:20 2015 (r276500) @@ -416,7 +416,7 @@ notfound: * and 8.3 filenames. Hence, it may not invalidate all negative * entries if a file with this name is later created. */ - if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE) + if ((cnp->cn_flags & MAKEENTRY) != 0) cache_enter(vdp, *vpp, cnp); #endif return (ENOENT); Modified: stable/10/sys/fs/nandfs/nandfs_vnops.c ============================================================================== --- stable/10/sys/fs/nandfs/nandfs_vnops.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/fs/nandfs/nandfs_vnops.c Thu Jan 1 10:44:20 2015 (r276500) @@ -479,7 +479,7 @@ out: * the file might not be found and thus putting it into the namecache * might be seen as negative caching. */ - if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE) + if ((cnp->cn_flags & MAKEENTRY) != 0) cache_enter(dvp, *vpp, cnp); return (error); Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clvnops.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/fs/nfsclient/nfs_clvnops.c Thu Jan 1 10:44:20 2015 (r276500) @@ -1185,8 +1185,7 @@ nfs_lookup(struct vop_lookup_args *ap) return (EJUSTRETURN); } - if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE && - dattrflag) { + if ((cnp->cn_flags & MAKEENTRY) != 0 && dattrflag) { /* * Cache the modification time of the parent * directory from the post-op attributes in Modified: stable/10/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Thu Jan 1 10:44:20 2015 (r276500) @@ -983,7 +983,7 @@ nfsrvd_create(struct nfsrv_descript *nd, goto out; } NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, CREATE, - LOCKPARENT | LOCKLEAF | SAVESTART); + LOCKPARENT | LOCKLEAF | SAVESTART | NOCACHE); nfsvno_setpathbuf(&named, &bufp, &hashp); error = nfsrv_parsename(nd, bufp, hashp, &named.ni_pathlen); if (error) @@ -1194,7 +1194,7 @@ nfsrvd_mknod(struct nfsrv_descript *nd, goto out; } } - NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, CREATE, cnflags); + NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, CREATE, cnflags | NOCACHE); nfsvno_setpathbuf(&named, &bufp, &hashp); error = nfsrv_parsename(nd, bufp, hashp, &named.ni_pathlen); if (error) @@ -1647,7 +1647,7 @@ nfsrvd_link(struct nfsrv_descript *nd, i } } NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, CREATE, - LOCKPARENT | SAVENAME); + LOCKPARENT | SAVENAME | NOCACHE); if (!nd->nd_repstat) { nfsvno_setpathbuf(&named, &bufp, &hashp); error = nfsrv_parsename(nd, bufp, hashp, &named.ni_pathlen); @@ -1724,7 +1724,7 @@ nfsrvd_symlink(struct nfsrv_descript *nd *vpp = NULL; NFSVNO_ATTRINIT(&nva); NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, CREATE, - LOCKPARENT | SAVESTART); + LOCKPARENT | SAVESTART | NOCACHE); nfsvno_setpathbuf(&named, &bufp, &hashp); error = nfsrv_parsename(nd, bufp, hashp, &named.ni_pathlen); if (!error && !nd->nd_repstat) @@ -1842,7 +1842,7 @@ nfsrvd_mkdir(struct nfsrv_descript *nd, goto out; } NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, CREATE, - LOCKPARENT | SAVENAME); + LOCKPARENT | SAVENAME | NOCACHE); nfsvno_setpathbuf(&named, &bufp, &hashp); error = nfsrv_parsename(nd, bufp, hashp, &named.ni_pathlen); if (error) @@ -2761,7 +2761,7 @@ nfsrvd_open(struct nfsrv_descript *nd, _ } if (create == NFSV4OPEN_CREATE) NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, CREATE, - LOCKPARENT | LOCKLEAF | SAVESTART); + LOCKPARENT | LOCKLEAF | SAVESTART | NOCACHE); else NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, LOOKUP, LOCKLEAF | SAVESTART); Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 1 10:44:20 2015 (r276500) @@ -195,7 +195,7 @@ tmpfs_lookup(struct vop_cachedlookup_arg /* Store the result of this lookup in the cache. Avoid this if the * request was for creation, as it does not improve timings on * emprical tests. */ - if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE) + if ((cnp->cn_flags & MAKEENTRY) != 0) cache_enter(dvp, *vpp, cnp); out: Modified: stable/10/sys/fs/unionfs/union_subr.c ============================================================================== --- stable/10/sys/fs/unionfs/union_subr.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/fs/unionfs/union_subr.c Thu Jan 1 10:44:20 2015 (r276500) @@ -536,6 +536,8 @@ unionfs_relookup(struct vnode *dvp, stru cn->cn_flags |= (cnp->cn_flags & (DOWHITEOUT | SAVESTART)); else if (RENAME == nameiop) cn->cn_flags |= (cnp->cn_flags & SAVESTART); + else if (nameiop == CREATE) + cn->cn_flags |= NOCACHE; vref(dvp); VOP_UNLOCK(dvp, LK_RELEASE); Modified: stable/10/sys/fs/unionfs/union_vnops.c ============================================================================== --- stable/10/sys/fs/unionfs/union_vnops.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/fs/unionfs/union_vnops.c Thu Jan 1 10:44:20 2015 (r276500) @@ -160,8 +160,7 @@ unionfs_lookup(struct vop_cachedlookup_a LK_RETRY); vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); - } else if (error == ENOENT && (cnflags & MAKEENTRY) && - nameiop != CREATE) + } else if (error == ENOENT && (cnflags & MAKEENTRY) != 0) cache_enter(dvp, NULLVP, cnp); UNIONFS_INTERNAL_DEBUG("unionfs_lookup: leave (%d)\n", error); @@ -337,7 +336,7 @@ unionfs_lookup_out: if (lvp != NULLVP) vrele(lvp); - if (error == ENOENT && (cnflags & MAKEENTRY) && nameiop != CREATE) + if (error == ENOENT && (cnflags & MAKEENTRY) != 0) cache_enter(dvp, NULLVP, cnp); UNIONFS_INTERNAL_DEBUG("unionfs_lookup: leave (%d)\n", error); Modified: stable/10/sys/kern/uipc_usrreq.c ============================================================================== --- stable/10/sys/kern/uipc_usrreq.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/kern/uipc_usrreq.c Thu Jan 1 10:44:20 2015 (r276500) @@ -505,7 +505,7 @@ uipc_bindat(int fd, struct socket *so, s buf[namelen] = 0; restart: - NDINIT_ATRIGHTS(&nd, CREATE, NOFOLLOW | LOCKPARENT | SAVENAME, + NDINIT_ATRIGHTS(&nd, CREATE, NOFOLLOW | LOCKPARENT | SAVENAME | NOCACHE, UIO_SYSSPACE, buf, fd, cap_rights_init(&rights, CAP_BINDAT), td); /* SHOULD BE ABLE TO ADOPT EXISTING AND wakeup() ALA FIFO's */ error = namei(&nd); Modified: stable/10/sys/kern/vfs_syscalls.c ============================================================================== --- stable/10/sys/kern/vfs_syscalls.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/kern/vfs_syscalls.c Thu Jan 1 10:44:20 2015 (r276500) @@ -1286,8 +1286,9 @@ kern_mknodat(struct thread *td, int fd, return (error); restart: bwillwrite(); - NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1, - pathseg, path, fd, cap_rights_init(&rights, CAP_MKNODAT), td); + NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | + NOCACHE, pathseg, path, fd, cap_rights_init(&rights, CAP_MKNODAT), + td); if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; @@ -1407,8 +1408,9 @@ kern_mkfifoat(struct thread *td, int fd, AUDIT_ARG_MODE(mode); restart: bwillwrite(); - NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1, - pathseg, path, fd, cap_rights_init(&rights, CAP_MKFIFOAT), td); + NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | + NOCACHE, pathseg, path, fd, cap_rights_init(&rights, CAP_MKFIFOAT), + td); if ((error = namei(&nd)) != 0) return (error); if (nd.ni_vp != NULL) { @@ -1559,8 +1561,9 @@ again: vrele(vp); return (EPERM); /* POSIX */ } - NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE2, - segflg, path2, fd2, cap_rights_init(&rights, CAP_LINKAT), td); + NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE2 | + NOCACHE, segflg, path2, fd2, cap_rights_init(&rights, CAP_LINKAT), + td); if ((error = namei(&nd)) == 0) { if (nd.ni_vp != NULL) { NDFREE(&nd, NDF_ONLY_PNBUF); @@ -1685,8 +1688,9 @@ kern_symlinkat(struct thread *td, char * AUDIT_ARG_TEXT(syspath); restart: bwillwrite(); - NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1, - segflg, path2, fd, cap_rights_init(&rights, CAP_SYMLINKAT), td); + NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | + NOCACHE, segflg, path2, fd, cap_rights_init(&rights, CAP_SYMLINKAT), + td); if ((error = namei(&nd)) != 0) goto out; if (nd.ni_vp) { @@ -3704,8 +3708,9 @@ kern_mkdirat(struct thread *td, int fd, AUDIT_ARG_MODE(mode); restart: bwillwrite(); - NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1, - segflg, path, fd, cap_rights_init(&rights, CAP_MKDIRAT), td); + NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | + NOCACHE, segflg, path, fd, cap_rights_init(&rights, CAP_MKDIRAT), + td); nd.ni_cnd.cn_flags |= WILLBEDIR; if ((error = namei(&nd)) != 0) return (error); Modified: stable/10/sys/kern/vfs_vnops.c ============================================================================== --- stable/10/sys/kern/vfs_vnops.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/kern/vfs_vnops.c Thu Jan 1 10:44:20 2015 (r276500) @@ -187,7 +187,11 @@ restart: fmode = *flagp; if (fmode & O_CREAT) { ndp->ni_cnd.cn_nameiop = CREATE; - ndp->ni_cnd.cn_flags = ISOPEN | LOCKPARENT | LOCKLEAF; + /* + * Set NOCACHE to avoid flushing the cache when + * rolling in many files at once. + */ + ndp->ni_cnd.cn_flags = ISOPEN | LOCKPARENT | LOCKLEAF | NOCACHE; if ((fmode & O_EXCL) == 0 && (fmode & O_NOFOLLOW) == 0) ndp->ni_cnd.cn_flags |= FOLLOW; if (!(vn_open_flags & VN_OPEN_NOAUDIT)) Modified: stable/10/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/10/sys/nfsclient/nfs_vnops.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/nfsclient/nfs_vnops.c Thu Jan 1 10:44:20 2015 (r276500) @@ -1181,8 +1181,7 @@ nfsmout: return (EJUSTRETURN); } - if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE && - dattrflag) { + if ((cnp->cn_flags & MAKEENTRY) != 0 && dattrflag) { /* * Cache the modification time of the parent * directory from the post-op attributes in Modified: stable/10/sys/nfsserver/nfs_serv.c ============================================================================== --- stable/10/sys/nfsserver/nfs_serv.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/nfsserver/nfs_serv.c Thu Jan 1 10:44:20 2015 (r276500) @@ -1217,7 +1217,7 @@ nfsrv_create(struct nfsrv_descript *nfsd nd.ni_cnd.cn_cred = cred; nd.ni_cnd.cn_nameiop = CREATE; - nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | SAVESTART; + nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | SAVESTART | NOCACHE; /* * Call namei and do initial cleanup to get a few things @@ -1501,7 +1501,7 @@ nfsrv_mknod(struct nfsrv_descript *nfsd, nd.ni_cnd.cn_cred = cred; nd.ni_cnd.cn_nameiop = CREATE; - nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | SAVESTART; + nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | SAVESTART | NOCACHE; /* * Handle nfs_namei() call. If an error occurs, the nd structure @@ -2030,7 +2030,7 @@ nfsrv_link(struct nfsrv_descript *nfsd, VOP_UNLOCK(vp, 0); nd.ni_cnd.cn_cred = cred; nd.ni_cnd.cn_nameiop = CREATE; - nd.ni_cnd.cn_flags = LOCKPARENT; + nd.ni_cnd.cn_flags = LOCKPARENT | NOCACHE; error = nfs_namei(&nd, nfsd, dfhp, len, slp, nam, &md, &dpos, &dirp, v3, &dirfor, &dirfor_ret, FALSE); if (dirp && !v3) { @@ -2153,7 +2153,7 @@ nfsrv_symlink(struct nfsrv_descript *nfs nfsm_srvnamesiz(len); nd.ni_cnd.cn_cred = cred; nd.ni_cnd.cn_nameiop = CREATE; - nd.ni_cnd.cn_flags = LOCKPARENT | SAVESTART; + nd.ni_cnd.cn_flags = LOCKPARENT | SAVESTART | NOCACHE; error = nfs_namei(&nd, nfsd, fhp, len, slp, nam, &md, &dpos, &dirp, v3, &dirfor, &dirfor_ret, FALSE); if (error == 0) { @@ -2325,7 +2325,7 @@ nfsrv_mkdir(struct nfsrv_descript *nfsd, nfsm_srvnamesiz(len); nd.ni_cnd.cn_cred = cred; nd.ni_cnd.cn_nameiop = CREATE; - nd.ni_cnd.cn_flags = LOCKPARENT; + nd.ni_cnd.cn_flags = LOCKPARENT | NOCACHE; error = nfs_namei(&nd, nfsd, fhp, len, slp, nam, &md, &dpos, &dirp, v3, &dirfor, &dirfor_ret, FALSE); Modified: stable/10/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_snapshot.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/ufs/ffs/ffs_snapshot.c Thu Jan 1 10:44:20 2015 (r276500) @@ -256,7 +256,8 @@ ffs_snapshot(mp, snapfile) * Create the snapshot file. */ restart: - NDINIT(&nd, CREATE, LOCKPARENT | LOCKLEAF, UIO_SYSSPACE, snapfile, td); + NDINIT(&nd, CREATE, LOCKPARENT | LOCKLEAF | NOCACHE, UIO_SYSSPACE, + snapfile, td); if ((error = namei(&nd)) != 0) return (error); if (nd.ni_vp != NULL) { Modified: stable/10/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- stable/10/sys/ufs/ufs/ufs_lookup.c Thu Jan 1 10:07:57 2015 (r276499) +++ stable/10/sys/ufs/ufs/ufs_lookup.c Thu Jan 1 10:44:20 2015 (r276500) @@ -550,7 +550,7 @@ notfound: /* * Insert name into cache (as non-existent) if appropriate. */ - if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE) + if ((cnp->cn_flags & MAKEENTRY) != 0) cache_enter(vdp, NULL, cnp); return (ENOENT);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501011044.t01AiLDp050836>