vfs: remove cn_thread

It is always curthread.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D32453
This commit is contained in:
Mateusz Guzik 2021-10-01 23:16:54 +02:00
parent 9017870541
commit b4a58fbf64
26 changed files with 94 additions and 113 deletions

View File

@ -1324,7 +1324,6 @@ zfs_lookup_internal(znode_t *dzp, const char *name, vnode_t **vpp,
cnp->cn_flags = ISLASTCN | SAVENAME;
cnp->cn_lkflags = LK_EXCLUSIVE | LK_RETRY;
cnp->cn_cred = kcred;
cnp->cn_thread = curthread;
if (zfsvfs->z_use_namecache && !zfsvfs->z_replay) {
struct vop_lookup_args a;
@ -4579,7 +4578,7 @@ zfs_freebsd_lookup(struct vop_lookup_args *ap, boolean_t cached)
strlcpy(nm, cnp->cn_nameptr, MIN(cnp->cn_namelen + 1, sizeof (nm)));
return (zfs_lookup(ap->a_dvp, nm, ap->a_vpp, cnp, cnp->cn_nameiop,
cnp->cn_cred, cnp->cn_thread, 0, cached));
cnp->cn_cred, curthread, 0, cached));
}
static int

View File

@ -250,7 +250,7 @@ autofs_lookup(struct vop_lookup_args *ap)
}
if (autofs_cached(anp, cnp->cn_nameptr, cnp->cn_namelen) == false &&
autofs_ignore_thread(cnp->cn_thread) == false) {
autofs_ignore_thread(curthread) == false) {
error = autofs_trigger_vn(dvp,
cnp->cn_nameptr, cnp->cn_namelen, &newvp);
if (error != 0)

View File

@ -1044,11 +1044,11 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlock)
int error, flags, nameiop, dvplocked;
char specname[SPECNAMELEN + 1], *pname;
td = curthread;
cnp = ap->a_cnp;
vpp = ap->a_vpp;
dvp = ap->a_dvp;
pname = cnp->cn_nameptr;
td = cnp->cn_thread;
flags = cnp->cn_flags;
nameiop = cnp->cn_nameiop;
mp = dvp->v_mount;

View File

@ -492,7 +492,7 @@ ext2_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp
* Access for write is interpreted as allowing
* creation of files in the directory.
*/
if ((error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread)) != 0)
if ((error = VOP_ACCESS(vdp, VWRITE, cred, curthread)) != 0)
return (error);
/*
* Return an indication of where the new directory
@ -571,7 +571,7 @@ ext2_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp
/*
* Write access to directory required to delete files.
*/
if ((error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread)) != 0)
if ((error = VOP_ACCESS(vdp, VWRITE, cred, curthread)) != 0)
return (error);
/*
* Return pointer to current entry in dp->i_offset,
@ -623,7 +623,7 @@ ext2_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp
* regular file, or empty directory.
*/
if (nameiop == RENAME && (flags & ISLASTCN)) {
if ((error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread)) != 0)
if ((error = VOP_ACCESS(vdp, VWRITE, cred, curthread)) != 0)
return (error);
/*
* Careful about locking second inode.
@ -992,7 +992,7 @@ ext2_direnter(struct inode *ip, struct vnode *dvp, struct componentname *cnp)
error = ext2_add_entry(dvp, &newdir);
if (!error && dp->i_endoff && dp->i_endoff < dp->i_size)
error = ext2_truncate(dvp, (off_t)dp->i_endoff, IO_SYNC,
cnp->cn_cred, cnp->cn_thread);
cnp->cn_cred, curthread);
return (error);
}

View File

@ -906,7 +906,7 @@ ext2_rename(struct vop_rename_args *ap)
* to namei, as the parent directory is unlocked by the
* call to checkpath().
*/
error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread);
error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, curthread);
VOP_UNLOCK(fvp);
if (oldparent != dp->i_number)
newparent = dp->i_number;
@ -1031,7 +1031,7 @@ ext2_rename(struct vop_rename_args *ap)
if (xp->i_nlink > 2)
panic("ext2_rename: linked directory");
error = ext2_truncate(tvp, (off_t)0, IO_SYNC,
tcnp->cn_cred, tcnp->cn_thread);
tcnp->cn_cred, curthread);
xp->i_nlink = 0;
}
xp->i_flag |= IN_CHANGE;
@ -1424,7 +1424,7 @@ ext2_mkdir(struct vop_mkdir_args *ap)
#ifdef UFS_ACL
if (dvp->v_mount->mnt_flag & MNT_ACLS) {
error = ext2_do_posix1e_acl_inheritance_dir(dvp, tvp, dmode,
cnp->cn_cred, cnp->cn_thread);
cnp->cn_cred, curthread);
if (error)
goto bad;
}
@ -1504,7 +1504,7 @@ ext2_rmdir(struct vop_rmdir_args *ap)
*/
ip->i_nlink = 0;
error = ext2_truncate(vp, (off_t)0, IO_SYNC, cnp->cn_cred,
cnp->cn_thread);
curthread);
cache_purge(ITOV(ip));
if (vn_lock(dvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) {
VOP_UNLOCK(vp);
@ -2004,7 +2004,7 @@ ext2_makeinode(int mode, struct vnode *dvp, struct vnode **vpp,
#ifdef UFS_ACL
if (dvp->v_mount->mnt_flag & MNT_ACLS) {
error = ext2_do_posix1e_acl_inheritance_file(dvp, tvp, mode,
cnp->cn_cred, cnp->cn_thread);
cnp->cn_cred, curthread);
if (error)
goto bad;
}

View File

@ -293,7 +293,7 @@ fdesc_lookup(struct vop_lookup_args *ap)
struct vnode *dvp = ap->a_dvp;
struct componentname *cnp = ap->a_cnp;
char *pname = cnp->cn_nameptr;
struct thread *td = cnp->cn_thread;
struct thread *td = curthread;
struct file *fp;
struct fdesc_get_ino_args arg;
int nlen = cnp->cn_namelen;

View File

@ -477,7 +477,6 @@ fuse_internal_invalidate_entry(struct mount *mp, struct uio *uio)
cn.cn_nameiop = LOOKUP;
cn.cn_flags = 0; /* !MAKEENTRY means free cached entry */
cn.cn_thread = curthread;
cn.cn_cred = curthread->td_ucred;
cn.cn_lkflags = LK_SHARED;
cn.cn_pnbuf = NULL;
@ -729,7 +728,7 @@ fuse_internal_remove(struct vnode *dvp,
int err = 0;
fdisp_init(&fdi, cnp->cn_namelen + 1);
fdisp_make_vp(&fdi, op, dvp, cnp->cn_thread, cnp->cn_cred);
fdisp_make_vp(&fdi, op, dvp, curthread, cnp->cn_cred);
memcpy(fdi.indata, cnp->cn_nameptr, cnp->cn_namelen);
((char *)fdi.indata)[cnp->cn_namelen] = '\0';
@ -781,7 +780,7 @@ fuse_internal_rename(struct vnode *fdvp,
int err = 0;
fdisp_init(&fdi, sizeof(*fri) + fcnp->cn_namelen + tcnp->cn_namelen + 2);
fdisp_make_vp(&fdi, FUSE_RENAME, fdvp, tcnp->cn_thread, tcnp->cn_cred);
fdisp_make_vp(&fdi, FUSE_RENAME, fdvp, curthread, tcnp->cn_cred);
fri = fdi.indata;
fri->newdir = VTOI(tdvp);
@ -813,7 +812,7 @@ fuse_internal_newentry_makerequest(struct mount *mp,
{
fdip->iosize = bufsize + cnp->cn_namelen + 1;
fdisp_make(fdip, op, mp, dnid, cnp->cn_thread, cnp->cn_cred);
fdisp_make(fdip, op, mp, dnid, curthread, cnp->cn_cred);
memcpy(fdip->indata, buf, bufsize);
memcpy((char *)fdip->indata + bufsize, cnp->cn_nameptr, cnp->cn_namelen);
((char *)fdip->indata)[bufsize + cnp->cn_namelen] = '\0';
@ -840,7 +839,7 @@ fuse_internal_newentry_core(struct vnode *dvp,
}
err = fuse_vnode_get(mp, feo, feo->nodeid, dvp, vpp, cnp, vtyp);
if (err) {
fuse_internal_forget_send(mp, cnp->cn_thread, cnp->cn_cred,
fuse_internal_forget_send(mp, curthread, cnp->cn_cred,
feo->nodeid, 1);
return err;
}

View File

@ -286,7 +286,7 @@ fuse_vnode_get(struct mount *mp,
struct componentname *cnp,
enum vtype vtyp)
{
struct thread *td = (cnp != NULL ? cnp->cn_thread : curthread);
struct thread *td = curthread;
/*
* feo should only be NULL for the root directory, which (when libfuse
* is used) always has generation 0

View File

@ -788,7 +788,7 @@ fuse_vnop_create(struct vop_create_args *ap)
struct vnode **vpp = ap->a_vpp;
struct componentname *cnp = ap->a_cnp;
struct vattr *vap = ap->a_vap;
struct thread *td = cnp->cn_thread;
struct thread *td = curthread;
struct ucred *cred = cnp->cn_cred;
struct fuse_data *data;
@ -1203,7 +1203,7 @@ fuse_vnop_lookup(struct vop_lookup_args *ap)
struct vnode *dvp = ap->a_dvp;
struct vnode **vpp = ap->a_vpp;
struct componentname *cnp = ap->a_cnp;
struct thread *td = cnp->cn_thread;
struct thread *td = curthread;
struct ucred *cred = cnp->cn_cred;
int nameiop = cnp->cn_nameiop;
@ -1849,7 +1849,7 @@ fuse_vnop_rename(struct vop_rename_args *ap)
data = fuse_get_mpdata(vnode_mount(tdvp));
if (data->dataflags & FSESS_DEFAULT_PERMISSIONS && isdir && newparent) {
err = fuse_internal_access(fvp, VWRITE,
tcnp->cn_thread, tcnp->cn_cred);
curthread, tcnp->cn_cred);
if (err)
goto out;
}

View File

@ -381,7 +381,7 @@ msdosfs_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname
* Access for write is interpreted as allowing
* creation of files in the directory.
*/
error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_thread);
error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, curthread);
if (error)
return (error);
/*
@ -485,7 +485,7 @@ msdosfs_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname
/*
* Write access to directory required to delete files.
*/
error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_thread);
error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, curthread);
if (error)
return (error);
@ -515,7 +515,7 @@ msdosfs_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname
if (blkoff == MSDOSFSROOT_OFS)
return (EBUSY);
error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_thread);
error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, curthread);
if (error)
return (error);

View File

@ -1109,7 +1109,7 @@ msdosfs_rename(struct vop_rename_args *ap)
* to namei, as the parent directory is unlocked by the
* call to doscheckpath().
*/
error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread);
error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, curthread);
if (fdip->de_StartCluster != tdip->de_StartCluster)
newparent = true;
if (doingdirectory && newparent) {

View File

@ -1165,7 +1165,7 @@ nfs_lookup(struct vop_lookup_args *ap)
struct nfsmount *nmp;
struct nfsnode *np, *newnp;
int error = 0, attrflag, dattrflag, ltype, ncticks;
struct thread *td = cnp->cn_thread;
struct thread *td = curthread;
struct nfsfh *nfhp;
struct nfsvattr dnfsva, nfsva;
struct vattr vattr;
@ -1596,17 +1596,17 @@ nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)))
return (error);
error = nfsrpc_mknod(dvp, cnp->cn_nameptr, cnp->cn_namelen, vap,
rdev, vap->va_type, cnp->cn_cred, cnp->cn_thread, &dnfsva,
rdev, vap->va_type, cnp->cn_cred, curthread, &dnfsva,
&nfsva, &nfhp, &attrflag, &dattrflag, NULL);
if (!error) {
if (!nfhp)
(void) nfsrpc_lookup(dvp, cnp->cn_nameptr,
cnp->cn_namelen, cnp->cn_cred, cnp->cn_thread,
cnp->cn_namelen, cnp->cn_cred, curthread,
&dnfsva, &nfsva, &nfhp, &attrflag, &dattrflag,
NULL, 0);
if (nfhp)
error = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp,
cnp->cn_thread, &np, NULL, LK_EXCLUSIVE);
curthread, &np, NULL, LK_EXCLUSIVE);
}
if (dattrflag)
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
@ -1622,7 +1622,7 @@ nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
if (!error) {
*vpp = newvp;
} else if (NFS_ISV4(dvp)) {
error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid,
error = nfscl_maperr(curthread, error, vap->va_uid,
vap->va_gid);
}
dnp = VTONFS(dvp);
@ -1712,17 +1712,17 @@ nfs_create(struct vop_create_args *ap)
cverf = nfs_get_cverf();
error = nfsrpc_create(dvp, cnp->cn_nameptr, cnp->cn_namelen,
vap, cverf, fmode, cnp->cn_cred, cnp->cn_thread, &dnfsva, &nfsva,
vap, cverf, fmode, cnp->cn_cred, curthread, &dnfsva, &nfsva,
&nfhp, &attrflag, &dattrflag, NULL);
if (!error) {
if (nfhp == NULL)
(void) nfsrpc_lookup(dvp, cnp->cn_nameptr,
cnp->cn_namelen, cnp->cn_cred, cnp->cn_thread,
cnp->cn_namelen, cnp->cn_cred, curthread,
&dnfsva, &nfsva, &nfhp, &attrflag, &dattrflag,
NULL, 0);
if (nfhp != NULL)
error = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp,
cnp->cn_thread, &np, NULL, LK_EXCLUSIVE);
curthread, &np, NULL, LK_EXCLUSIVE);
}
if (dattrflag)
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
@ -1730,7 +1730,7 @@ nfs_create(struct vop_create_args *ap)
newvp = NFSTOV(np);
if (attrflag == 0)
error = nfsrpc_getattr(newvp, cnp->cn_cred,
cnp->cn_thread, &nfsva, NULL);
curthread, &nfsva, NULL);
if (error == 0)
error = nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
0, 1);
@ -1748,14 +1748,14 @@ nfs_create(struct vop_create_args *ap)
} else if (NFS_ISV34(dvp) && (fmode & O_EXCL)) {
if (nfscl_checksattr(vap, &nfsva)) {
error = nfsrpc_setattr(newvp, vap, NULL, cnp->cn_cred,
cnp->cn_thread, &nfsva, &attrflag, NULL);
curthread, &nfsva, &attrflag, NULL);
if (error && (vap->va_uid != (uid_t)VNOVAL ||
vap->va_gid != (gid_t)VNOVAL)) {
/* try again without setting uid/gid */
vap->va_uid = (uid_t)VNOVAL;
vap->va_gid = (uid_t)VNOVAL;
error = nfsrpc_setattr(newvp, vap, NULL,
cnp->cn_cred, cnp->cn_thread, &nfsva,
cnp->cn_cred, curthread, &nfsva,
&attrflag, NULL);
}
if (attrflag)
@ -1776,7 +1776,7 @@ nfs_create(struct vop_create_args *ap)
}
*ap->a_vpp = newvp;
} else if (NFS_ISV4(dvp)) {
error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid,
error = nfscl_maperr(curthread, error, vap->va_uid,
vap->va_gid);
}
NFSLOCKNODE(dnp);
@ -1829,11 +1829,11 @@ nfs_remove(struct vop_remove_args *ap)
* throw away biocache buffers, mainly to avoid
* unnecessary delayed writes later.
*/
error = ncl_vinvalbuf(vp, 0, cnp->cn_thread, 1);
error = ncl_vinvalbuf(vp, 0, curthread, 1);
if (error != EINTR && error != EIO)
/* Do the rpc */
error = nfs_removerpc(dvp, vp, cnp->cn_nameptr,
cnp->cn_namelen, cnp->cn_cred, cnp->cn_thread);
cnp->cn_namelen, cnp->cn_cred, curthread);
/*
* Kludge City: If the first reply to the remove rpc is lost..
* the reply to the retransmitted request will be ENOENT
@ -1953,10 +1953,10 @@ nfs_rename(struct vop_rename_args *ap)
* that was written back to our cache earlier. Not checking for
* this condition can result in potential (silent) data loss.
*/
error = VOP_FSYNC(fvp, MNT_WAIT, fcnp->cn_thread);
error = VOP_FSYNC(fvp, MNT_WAIT, curthread);
NFSVOPUNLOCK(fvp);
if (!error && tvp)
error = VOP_FSYNC(tvp, MNT_WAIT, tcnp->cn_thread);
error = VOP_FSYNC(tvp, MNT_WAIT, curthread);
if (error)
goto out;
@ -1973,7 +1973,7 @@ nfs_rename(struct vop_rename_args *ap)
error = nfs_renamerpc(fdvp, fvp, fcnp->cn_nameptr, fcnp->cn_namelen,
tdvp, tvp, tcnp->cn_nameptr, tcnp->cn_namelen, tcnp->cn_cred,
tcnp->cn_thread);
curthread);
if (error == 0 && NFS_ISV4(tdvp)) {
/*
@ -2050,7 +2050,7 @@ nfs_renameit(struct vnode *sdvp, struct vnode *svp, struct componentname *scnp,
return (nfs_renamerpc(sdvp, svp, scnp->cn_nameptr, scnp->cn_namelen,
sdvp, NULL, sp->s_name, sp->s_namlen, scnp->cn_cred,
scnp->cn_thread));
curthread));
}
/*
@ -2112,10 +2112,10 @@ nfs_link(struct vop_link_args *ap)
* doesn't get "out of sync" with the server.
* XXX There should be a better way!
*/
VOP_FSYNC(vp, MNT_WAIT, cnp->cn_thread);
VOP_FSYNC(vp, MNT_WAIT, curthread);
error = nfsrpc_link(tdvp, vp, cnp->cn_nameptr, cnp->cn_namelen,
cnp->cn_cred, cnp->cn_thread, &dnfsva, &nfsva, &attrflag,
cnp->cn_cred, curthread, &dnfsva, &nfsva, &attrflag,
&dattrflag, NULL);
tdnp = VTONFS(tdvp);
NFSLOCKNODE(tdnp);
@ -2152,7 +2152,7 @@ nfs_link(struct vop_link_args *ap)
"the directory as the new link\n");
}
if (error && NFS_ISV4(vp))
error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0,
error = nfscl_maperr(curthread, error, (uid_t)0,
(gid_t)0);
return (error);
}
@ -2174,10 +2174,10 @@ nfs_symlink(struct vop_symlink_args *ap)
vap->va_type = VLNK;
error = nfsrpc_symlink(dvp, cnp->cn_nameptr, cnp->cn_namelen,
ap->a_target, vap, cnp->cn_cred, cnp->cn_thread, &dnfsva,
ap->a_target, vap, cnp->cn_cred, curthread, &dnfsva,
&nfsva, &nfhp, &attrflag, &dattrflag, NULL);
if (nfhp) {
ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, cnp->cn_thread,
ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, curthread,
&np, NULL, LK_EXCLUSIVE);
if (!ret)
newvp = NFSTOV(np);
@ -2195,7 +2195,7 @@ nfs_symlink(struct vop_symlink_args *ap)
* have to do a lookup in order to obtain a newvp to return.
*/
error = nfs_lookitup(dvp, cnp->cn_nameptr, cnp->cn_namelen,
cnp->cn_cred, cnp->cn_thread, &np);
cnp->cn_cred, curthread, &np);
if (!error)
newvp = NFSTOV(np);
}
@ -2203,7 +2203,7 @@ nfs_symlink(struct vop_symlink_args *ap)
if (newvp)
vput(newvp);
if (NFS_ISV4(dvp))
error = nfscl_maperr(cnp->cn_thread, error,
error = nfscl_maperr(curthread, error,
vap->va_uid, vap->va_gid);
} else {
*ap->a_vpp = newvp;
@ -2258,7 +2258,7 @@ nfs_mkdir(struct vop_mkdir_args *ap)
return (error);
vap->va_type = VDIR;
error = nfsrpc_mkdir(dvp, cnp->cn_nameptr, cnp->cn_namelen,
vap, cnp->cn_cred, cnp->cn_thread, &dnfsva, &nfsva, &nfhp,
vap, cnp->cn_cred, curthread, &dnfsva, &nfsva, &nfhp,
&attrflag, &dattrflag, NULL);
dnp = VTONFS(dvp);
NFSLOCKNODE(dnp);
@ -2272,7 +2272,7 @@ nfs_mkdir(struct vop_mkdir_args *ap)
KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp);
}
if (nfhp) {
ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, cnp->cn_thread,
ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, curthread,
&np, NULL, LK_EXCLUSIVE);
if (!ret) {
newvp = NFSTOV(np);
@ -2284,7 +2284,7 @@ nfs_mkdir(struct vop_mkdir_args *ap)
}
if (!error && newvp == NULL) {
error = nfs_lookitup(dvp, cnp->cn_nameptr, cnp->cn_namelen,
cnp->cn_cred, cnp->cn_thread, &np);
cnp->cn_cred, curthread, &np);
if (!error) {
newvp = NFSTOV(np);
if (newvp->v_type != VDIR)
@ -2295,7 +2295,7 @@ nfs_mkdir(struct vop_mkdir_args *ap)
if (newvp)
vput(newvp);
if (NFS_ISV4(dvp))
error = nfscl_maperr(cnp->cn_thread, error,
error = nfscl_maperr(curthread, error,
vap->va_uid, vap->va_gid);
} else {
/*
@ -2336,7 +2336,7 @@ nfs_rmdir(struct vop_rmdir_args *ap)
if (dvp == vp)
return (EINVAL);
error = nfsrpc_rmdir(dvp, cnp->cn_nameptr, cnp->cn_namelen,
cnp->cn_cred, cnp->cn_thread, &dnfsva, &dattrflag, NULL);
cnp->cn_cred, curthread, &dnfsva, &dattrflag, NULL);
dnp = VTONFS(dvp);
NFSLOCKNODE(dnp);
dnp->n_flag |= NMODIFIED;
@ -2352,7 +2352,7 @@ nfs_rmdir(struct vop_rmdir_args *ap)
cache_purge(dvp);
cache_purge(vp);
if (error && NFS_ISV4(dvp))
error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0,
error = nfscl_maperr(curthread, error, (uid_t)0,
(gid_t)0);
/*
* Kludge: Map ENOENT => 0 assuming that you have a reply to a retry.
@ -2591,14 +2591,14 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
* The name is now changed to .nfs.<ticks>.<pid>.4, where ticks is
* CPU ticks since boot.
*/
pid = cnp->cn_thread->td_proc->p_pid;
pid = curthread->td_proc->p_pid;
lticks = (unsigned int)ticks;
for ( ; ; ) {
sp->s_namlen = sprintf(sp->s_name,
".nfs.%08x.%04x4.4", lticks,
pid);
if (nfs_lookitup(dvp, sp->s_name, sp->s_namlen, sp->s_cred,
cnp->cn_thread, NULL))
curthread, NULL))
break;
lticks++;
}
@ -2606,7 +2606,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
if (error)
goto bad;
error = nfs_lookitup(dvp, sp->s_name, sp->s_namlen, sp->s_cred,
cnp->cn_thread, &np);
curthread, &np);
np->n_sillyrename = sp;
return (0);
bad:

View File

@ -661,7 +661,6 @@ nfsvno_namei(struct nfsrv_descript *nd, struct nameidata *ndp,
* because lookup() will dereference ni_startdir.
*/
cnp->cn_thread = curthread;
ndp->ni_startdir = dp;
ndp->ni_rootdir = rootvnode;
ndp->ni_topdir = NULL;
@ -2526,7 +2525,6 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram,
cn.cn_nameiop = LOOKUP;
cn.cn_lkflags = LK_SHARED | LK_RETRY;
cn.cn_cred = nd->nd_cred;
cn.cn_thread = p;
} else if (r == 0)
vput(nvp);
}
@ -2626,7 +2624,6 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram,
LK_RETRY;
cn.cn_cred =
nd->nd_cred;
cn.cn_thread = p;
}
cn.cn_nameptr = dp->d_name;
cn.cn_namelen = nlen;
@ -4183,7 +4180,6 @@ nfsrv_dscreate(struct vnode *dvp, struct vattr *vap, struct vattr *nvap,
LOCKPARENT | LOCKLEAF | SAVESTART | NOCACHE);
nfsvno_setpathbuf(&named, &bufp, &hashp);
named.ni_cnd.cn_lkflags = LK_EXCLUSIVE;
named.ni_cnd.cn_thread = p;
named.ni_cnd.cn_nameptr = bufp;
if (fnamep != NULL) {
strlcpy(bufp, fnamep, PNFS_FILENAME_LEN + 1);
@ -4567,7 +4563,6 @@ nfsrv_dsremove(struct vnode *dvp, char *fname, struct ucred *tcred,
named.ni_cnd.cn_nameiop = DELETE;
named.ni_cnd.cn_lkflags = LK_EXCLUSIVE | LK_RETRY;
named.ni_cnd.cn_cred = tcred;
named.ni_cnd.cn_thread = p;
named.ni_cnd.cn_flags = ISLASTCN | LOCKPARENT | LOCKLEAF | SAVENAME;
nfsvno_setpathbuf(&named, &bufp, &hashp);
named.ni_cnd.cn_nameptr = bufp;
@ -6341,7 +6336,6 @@ nfsrv_pnfslookupds(struct vnode *vp, struct vnode *dvp, struct pnfsdsfile *pf,
named.ni_cnd.cn_nameiop = LOOKUP;
named.ni_cnd.cn_lkflags = LK_SHARED | LK_RETRY;
named.ni_cnd.cn_cred = tcred;
named.ni_cnd.cn_thread = p;
named.ni_cnd.cn_flags = ISLASTCN | LOCKPARENT | LOCKLEAF | SAVENAME;
nfsvno_setpathbuf(&named, &bufp, &hashp);
named.ni_cnd.cn_nameptr = bufp;

View File

@ -560,7 +560,7 @@ smbfs_create(ap)
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)))
return error;
scred = smbfs_malloc_scred();
smb_makescred(scred, cnp->cn_thread, cnp->cn_cred);
smb_makescred(scred, curthread, cnp->cn_cred);
error = smbfs_smb_create(dnp, name, nmlen, scred);
if (error)
@ -598,7 +598,7 @@ smbfs_remove(ap)
if (vp->v_type == VDIR || (np->n_flag & NOPEN) != 0 || vrefcnt(vp) != 1)
return EPERM;
scred = smbfs_malloc_scred();
smb_makescred(scred, cnp->cn_thread, cnp->cn_cred);
smb_makescred(scred, curthread, cnp->cn_cred);
error = smbfs_smb_delete(np, scred);
if (error == 0)
np->n_flag |= NGONE;
@ -652,7 +652,7 @@ smbfs_rename(ap)
return EINVAL;
}
scred = smbfs_malloc_scred();
smb_makescred(scred, tcnp->cn_thread, tcnp->cn_cred);
smb_makescred(scred, curthread, tcnp->cn_cred);
/*
* It seems that Samba doesn't implement SMB_COM_MOVE call...
*/
@ -769,7 +769,7 @@ smbfs_mkdir(ap)
if ((name[0] == '.') && ((len == 1) || ((len == 2) && (name[1] == '.'))))
return EEXIST;
scred = smbfs_malloc_scred();
smb_makescred(scred, cnp->cn_thread, cnp->cn_cred);
smb_makescred(scred, curthread, cnp->cn_cred);
error = smbfs_smb_mkdir(dnp, name, len, scred);
if (error)
goto out;
@ -809,7 +809,7 @@ smbfs_rmdir(ap)
return EINVAL;
scred = smbfs_malloc_scred();
smb_makescred(scred, cnp->cn_thread, cnp->cn_cred);
smb_makescred(scred, curthread, cnp->cn_cred);
error = smbfs_smb_rmdir(np, scred);
if (error == 0)
np->n_flag |= NGONE;
@ -1170,7 +1170,7 @@ smbfs_lookup(ap)
} */ *ap;
{
struct componentname *cnp = ap->a_cnp;
struct thread *td = cnp->cn_thread;
struct thread *td = curthread;
struct vnode *dvp = ap->a_dvp;
struct vnode **vpp = ap->a_vpp;
struct vnode *vp;

View File

@ -136,7 +136,7 @@ tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp)
cnp->cn_flags & DOWHITEOUT &&
cnp->cn_flags & ISWHITEOUT))) {
error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred,
cnp->cn_thread);
curthread);
if (error != 0)
goto out;
@ -180,7 +180,7 @@ tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp)
(cnp->cn_nameiop == DELETE ||
cnp->cn_nameiop == RENAME)) {
error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred,
cnp->cn_thread);
curthread);
if (error != 0)
goto out;
@ -192,8 +192,8 @@ tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp)
if ((dnode->tn_mode & S_ISTXT) &&
VOP_ACCESS(dvp, VADMIN, cnp->cn_cred,
cnp->cn_thread) && VOP_ACCESS(*vpp, VADMIN,
cnp->cn_cred, cnp->cn_thread)) {
curthread) && VOP_ACCESS(*vpp, VADMIN,
cnp->cn_cred, curthread)) {
error = EPERM;
vput(*vpp);
*vpp = NULL;

View File

@ -630,7 +630,6 @@ unionfs_relookup(struct vnode *dvp, struct vnode **vpp,
cn->cn_nameiop = nameiop;
cn->cn_flags = (LOCKPARENT | LOCKLEAF | HASBUF | SAVENAME | ISLASTCN);
cn->cn_lkflags = LK_EXCLUSIVE;
cn->cn_thread = td;
cn->cn_cred = cnp->cn_cred;
cn->cn_nameptr = cn->cn_pnbuf;
@ -975,7 +974,6 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp,
nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | HASBUF | SAVENAME |
ISLASTCN;
nd.ni_cnd.cn_lkflags = LK_EXCLUSIVE;
nd.ni_cnd.cn_thread = td;
nd.ni_cnd.cn_cred = cred;
nd.ni_cnd.cn_nameptr = nd.ni_cnd.cn_pnbuf;
NDPREINIT(&nd);
@ -1250,7 +1248,6 @@ unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td)
cn.cn_flags = LOCKPARENT | LOCKLEAF | SAVENAME |
RDONLY | ISLASTCN;
cn.cn_lkflags = LK_EXCLUSIVE;
cn.cn_thread = td;
cn.cn_cred = cred;
/*

View File

@ -853,12 +853,12 @@ mqfs_lookupx(struct vop_cachedlookup_args *ap)
char *pname;
struct thread *td;
td = curthread;
cnp = ap->a_cnp;
vpp = ap->a_vpp;
dvp = ap->a_dvp;
pname = cnp->cn_nameptr;
namelen = cnp->cn_namelen;
td = cnp->cn_thread;
flags = cnp->cn_flags;
nameiop = cnp->cn_nameiop;
pd = VTON(dvp);
@ -869,7 +869,7 @@ mqfs_lookupx(struct vop_cachedlookup_args *ap)
if (dvp->v_type != VDIR)
return (ENOTDIR);
error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, cnp->cn_thread);
error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td);
if (error)
return (error);

View File

@ -4219,7 +4219,7 @@ cache_can_fplookup(struct cache_fpl *fpl)
ndp = fpl->ndp;
cnp = fpl->cnp;
td = cnp->cn_thread;
td = curthread;
if (!atomic_load_char(&cache_fast_lookup_enabled)) {
cache_fpl_aborted_early(fpl);
@ -5984,7 +5984,6 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status,
fpl.ndp = ndp;
fpl.cnp = cnp = &ndp->ni_cnd;
MPASS(ndp->ni_lcf == 0);
MPASS(curthread == cnp->cn_thread);
KASSERT ((cnp->cn_flags & CACHE_FPL_INTERNAL_CN_FLAGS) == 0,
("%s: internal flags found in cn_flags %" PRIx64, __func__,
cnp->cn_flags));

View File

@ -294,7 +294,7 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp)
bool startdir_used;
cnp = &ndp->ni_cnd;
td = cnp->cn_thread;
td = curthread;
startdir_used = false;
*pwdp = NULL;
@ -552,10 +552,8 @@ namei(struct nameidata *ndp)
enum cache_fpl_status status;
cnp = &ndp->ni_cnd;
td = cnp->cn_thread;
td = curthread;
#ifdef INVARIANTS
KASSERT(cnp->cn_thread == curthread,
("namei not using curthread"));
KASSERT((ndp->ni_debugflags & NAMEI_DBG_CALLED) == 0,
("%s: repeated call to namei without NDREINIT", __func__));
KASSERT(ndp->ni_debugflags == NAMEI_DBG_INITED,
@ -581,7 +579,7 @@ namei(struct nameidata *ndp)
*/
cnp->cn_origflags = cnp->cn_flags;
#endif
ndp->ni_cnd.cn_cred = ndp->ni_cnd.cn_thread->td_ucred;
ndp->ni_cnd.cn_cred = td->td_ucred;
KASSERT(ndp->ni_resflags == 0, ("%s: garbage in ni_resflags: %x\n",
__func__, ndp->ni_resflags));
KASSERT(cnp->cn_cred && td->td_proc, ("namei: bad cred/proc"));
@ -1096,7 +1094,7 @@ lookup(struct nameidata *ndp)
*/
unionlookup:
#ifdef MAC
error = mac_vnode_check_lookup(cnp->cn_thread->td_ucred, dp, cnp);
error = mac_vnode_check_lookup(cnp->cn_cred, dp, cnp);
if (error)
goto bad;
#endif

View File

@ -6821,7 +6821,7 @@ vn_dir_check_exec(struct vnode *vp, struct componentname *cnp)
return (0);
}
return (VOP_ACCESS(vp, VEXEC, cnp->cn_cred, cnp->cn_thread));
return (VOP_ACCESS(vp, VEXEC, cnp->cn_cred, curthread));
}
/*

View File

@ -190,7 +190,7 @@ static int vn_io_fault1(struct vnode *vp, struct uio *uio,
int
vn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp)
{
struct thread *td = ndp->ni_cnd.cn_thread;
struct thread *td = curthread;
return (vn_open_cred(ndp, flagp, cmode, 0, td->td_ucred, fp));
}
@ -230,7 +230,6 @@ vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, u_int vn_open_flags,
{
struct vnode *vp;
struct mount *mp;
struct thread *td = ndp->ni_cnd.cn_thread;
struct vattr vat;
struct vattr *vap = &vat;
int fmode, error;
@ -332,7 +331,7 @@ vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, u_int vn_open_flags,
return (error);
vp = ndp->ni_vp;
}
error = vn_open_vnode(vp, fmode, cred, td, fp);
error = vn_open_vnode(vp, fmode, cred, curthread, fp);
if (first_open) {
VI_LOCK(vp);
vp->v_iflag &= ~VI_FOPENING;

View File

@ -49,7 +49,6 @@ struct componentname {
*/
u_int64_t cn_origflags; /* flags to namei */
u_int64_t cn_flags; /* flags to namei */
struct thread *cn_thread;/* thread requesting lookup */
struct ucred *cn_cred; /* credentials */
enum nameiop cn_nameiop; /* namei operation */
int cn_lkflags; /* Lock flags LK_EXCLUSIVE or LK_SHARED */
@ -262,7 +261,6 @@ do { \
_ndp->ni_startdir = startdir; \
_ndp->ni_resflags = 0; \
filecaps_init(&_ndp->ni_filecaps); \
_ndp->ni_cnd.cn_thread = td; \
_ndp->ni_rightsneeded = _rightsp; \
} while (0)

View File

@ -2975,7 +2975,6 @@ softdep_journal_lookup(mp, vpp)
bzero(&cnp, sizeof(cnp));
cnp.cn_nameiop = LOOKUP;
cnp.cn_flags = ISLASTCN;
cnp.cn_thread = curthread;
cnp.cn_cred = curthread->td_ucred;
cnp.cn_pnbuf = SUJ_FILE;
cnp.cn_nameptr = SUJ_FILE;

View File

@ -263,7 +263,6 @@ ufs_extattr_lookup(struct vnode *start_dvp, int lockparent, char *dirname,
if (lockparent == UE_GETDIR_LOCKPARENT)
cnp.cn_flags |= LOCKPARENT;
cnp.cn_lkflags = LK_EXCLUSIVE;
cnp.cn_thread = td;
cnp.cn_cred = td->td_ucred;
cnp.cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK);
cnp.cn_nameptr = cnp.cn_pnbuf;

View File

@ -230,7 +230,7 @@ ufs_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp,
* in VFS_VGET but we could end up creating objects
* that are never used.
*/
vnode_create_vobject(vdp, DIP(dp, i_size), cnp->cn_thread);
vnode_create_vobject(vdp, DIP(dp, i_size), curthread);
bmask = VFSTOUFS(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1;
@ -486,9 +486,9 @@ ufs_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp,
* XXX: Fix the comment above.
*/
if (flags & WILLBEDIR)
error = VOP_ACCESSX(vdp, VWRITE | VAPPEND, cred, cnp->cn_thread);
error = VOP_ACCESSX(vdp, VWRITE | VAPPEND, cred, curthread);
else
error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread);
error = VOP_ACCESS(vdp, VWRITE, cred, curthread);
if (error)
return (error);
/*
@ -601,7 +601,7 @@ ufs_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp,
if ((error = VFS_VGET(vdp->v_mount, ino,
LK_EXCLUSIVE, &tdp)) != 0)
return (error);
error = ufs_delete_denied(vdp, tdp, cred, cnp->cn_thread);
error = ufs_delete_denied(vdp, tdp, cred, curthread);
if (error) {
vput(tdp);
return (error);
@ -625,9 +625,9 @@ ufs_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp,
*/
if (nameiop == RENAME && (flags & ISLASTCN)) {
if (flags & WILLBEDIR)
error = VOP_ACCESSX(vdp, VWRITE | VAPPEND, cred, cnp->cn_thread);
error = VOP_ACCESSX(vdp, VWRITE | VAPPEND, cred, curthread);
else
error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread);
error = VOP_ACCESS(vdp, VWRITE, cred, curthread);
if (error)
return (error);
/*
@ -643,7 +643,7 @@ ufs_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp,
LK_EXCLUSIVE, &tdp)) != 0)
return (error);
error = ufs_delete_denied(vdp, tdp, cred, cnp->cn_thread);
error = ufs_delete_denied(vdp, tdp, cred, curthread);
if (error) {
vput(tdp);
return (error);
@ -660,9 +660,9 @@ ufs_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp,
* of EACCESS.
*/
if (tdp->v_type == VDIR)
error = VOP_ACCESSX(vdp, VWRITE | VAPPEND, cred, cnp->cn_thread);
error = VOP_ACCESSX(vdp, VWRITE | VAPPEND, cred, curthread);
else
error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread);
error = VOP_ACCESS(vdp, VWRITE, cred, curthread);
if (error) {
vput(tdp);
return (error);

View File

@ -1239,7 +1239,7 @@ ufs_rename(ap)
struct vnode *nvp;
struct componentname *tcnp = ap->a_tcnp;
struct componentname *fcnp = ap->a_fcnp;
struct thread *td = fcnp->cn_thread;
struct thread *td = curthread;
struct inode *fip, *tip, *tdp, *fdp;
struct direct newdir;
off_t endoff;
@ -1449,7 +1449,7 @@ ufs_rename(ap)
* as to be able to change "..".
*/
if (doingdirectory && newparent) {
error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread);
error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, curthread);
if (error)
goto unlockout;
@ -2091,12 +2091,12 @@ ufs_mkdir(ap)
#ifdef UFS_ACL
if (dvp->v_mount->mnt_flag & MNT_ACLS) {
error = ufs_do_posix1e_acl_inheritance_dir(dvp, tvp, dmode,
cnp->cn_cred, cnp->cn_thread);
cnp->cn_cred, curthread);
if (error)
goto bad;
} else if (dvp->v_mount->mnt_flag & MNT_NFS4ACLS) {
error = ufs_do_nfs4_acl_inheritance(dvp, tvp, dmode,
cnp->cn_cred, cnp->cn_thread);
cnp->cn_cred, curthread);
if (error)
goto bad;
}
@ -2858,12 +2858,12 @@ ufs_makeinode(mode, dvp, vpp, cnp, callfunc)
#ifdef UFS_ACL
if (dvp->v_mount->mnt_flag & MNT_ACLS) {
error = ufs_do_posix1e_acl_inheritance_file(dvp, tvp, mode,
cnp->cn_cred, cnp->cn_thread);
cnp->cn_cred, curthread);
if (error)
goto bad;
} else if (dvp->v_mount->mnt_flag & MNT_NFS4ACLS) {
error = ufs_do_nfs4_acl_inheritance(dvp, tvp, mode,
cnp->cn_cred, cnp->cn_thread);
cnp->cn_cred, curthread);
if (error)
goto bad;
}