From 8ecd87a3e7f5503951d37eab034cb330a1c6ec86 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Tue, 20 Oct 2020 07:18:27 +0000 Subject: [PATCH] vfs: drop spurious cred argument from VOP_VPTOCNP --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c | 3 +-- sys/fs/nullfs/null_vnops.c | 3 +-- sys/kern/vfs_cache.c | 8 ++++---- sys/kern/vfs_default.c | 3 ++- sys/kern/vnode_if.src | 1 - sys/sys/vnode.h | 3 +-- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c index 18c71511fcc..2b56deb6bf2 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c @@ -6507,8 +6507,7 @@ zfs_vptocnp(struct vop_vptocnp_args *ap) error = vget(covered_vp, LK_SHARED | LK_VNHELD, curthread); #endif if (error == 0) { - error = VOP_VPTOCNP(covered_vp, ap->a_vpp, ap->a_cred, - ap->a_buf, ap->a_buflen); + error = VOP_VPTOCNP(covered_vp, ap->a_vpp, ap->a_buf, ap->a_buflen); vput(covered_vp); } vn_lock(vp, ltype | LK_RETRY); diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index bb24ce60c17..d1033786574 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -909,7 +909,6 @@ null_vptocnp(struct vop_vptocnp_args *ap) struct vnode *vp = ap->a_vp; struct vnode **dvp = ap->a_vpp; struct vnode *lvp, *ldvp; - struct ucred *cred = ap->a_cred; struct mount *mp; int error, locked; @@ -921,7 +920,7 @@ null_vptocnp(struct vop_vptocnp_args *ap) VOP_UNLOCK(vp); /* vp is held by vn_vptocnp_locked that called us */ ldvp = lvp; vref(lvp); - error = vn_vptocnp(&ldvp, cred, ap->a_buf, ap->a_buflen); + error = vn_vptocnp(&ldvp, ap->a_buf, ap->a_buflen); vdrop(lvp); if (error != 0) { vn_lock(vp, locked | LK_RETRY); diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 8d73a02b88b..cf26c36a408 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -2811,7 +2811,7 @@ vn_dd_from_dst(struct vnode *vp) } int -vn_vptocnp(struct vnode **vp, struct ucred *cred, char *buf, size_t *buflen) +vn_vptocnp(struct vnode **vp, char *buf, size_t *buflen) { struct vnode *dvp; struct namecache *ncp; @@ -2853,7 +2853,7 @@ vn_vptocnp(struct vnode **vp, struct ucred *cred, char *buf, size_t *buflen) mtx_unlock(vlp); vn_lock(*vp, LK_SHARED | LK_RETRY); - error = VOP_VPTOCNP(*vp, &dvp, cred, buf, buflen); + error = VOP_VPTOCNP(*vp, &dvp, buf, buflen); vput(*vp); if (error) { counter_u64_add(numfullpathfail2, 1); @@ -2952,7 +2952,7 @@ vn_fullpath_dir(struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, error, vp, NULL); break; } - error = vn_vptocnp(&vp, curthread->td_ucred, buf, &buflen); + error = vn_vptocnp(&vp, buf, &buflen); if (error) break; if (buflen == 0) { @@ -3151,7 +3151,7 @@ vn_fullpath_any(struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, if (vp->v_type != VDIR) { *buflen -= 1; buf[*buflen] = '\0'; - error = vn_vptocnp(&vp, curthread->td_ucred, buf, buflen); + error = vn_vptocnp(&vp, buf, buflen); if (error) return (error); if (*buflen == 0) { diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 63392a4083d..64de62cca79 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -819,7 +819,7 @@ vop_stdvptocnp(struct vop_vptocnp_args *ap) { struct vnode *vp = ap->a_vp; struct vnode **dvp = ap->a_vpp; - struct ucred *cred = ap->a_cred; + struct ucred *cred; char *buf = ap->a_buf; size_t *buflen = ap->a_buflen; char *dirbuf, *cpos; @@ -836,6 +836,7 @@ vop_stdvptocnp(struct vop_vptocnp_args *ap) error = 0; covered = 0; td = curthread; + cred = td->td_ucred; if (vp->v_type != VDIR) return (ENOENT); diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index ad678625c00..8dd48de854d 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -682,7 +682,6 @@ vop_vptofh { vop_vptocnp { IN struct vnode *vp; OUT struct vnode **vpp; - IN struct ucred *cred; INOUT char *buf; INOUT size_t *buflen; }; diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 6b2e54ae587..5b330b50857 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -657,8 +657,7 @@ int insmntque1(struct vnode *vp, struct mount *mp, int insmntque(struct vnode *vp, struct mount *mp); u_quad_t init_va_filerev(void); int speedup_syncer(void); -int vn_vptocnp(struct vnode **vp, struct ucred *cred, char *buf, - size_t *buflen); +int vn_vptocnp(struct vnode **vp, char *buf, size_t *buflen); int vn_getcwd(char *buf, char **retbuf, size_t *buflen); int vn_fullpath(struct vnode *vp, char **retbuf, char **freebuf); int vn_fullpath_global(struct vnode *vp, char **retbuf, char **freebuf);