Decontextualize the couplet VOP_GETATTR / VOP_SETATTR as the passed thread
was always curthread and totally unuseful. Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
This commit is contained in:
parent
57b00b9998
commit
0359a12ead
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182371
@ -28,7 +28,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 24, 1996
|
||||
.Dd August 29, 2008
|
||||
.Os
|
||||
.Dt VOP_ATTRIB 9
|
||||
.Sh NAME
|
||||
@ -39,9 +39,9 @@
|
||||
.In sys/param.h
|
||||
.In sys/vnode.h
|
||||
.Ft int
|
||||
.Fn VOP_GETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred" "struct thread *td"
|
||||
.Fn VOP_GETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred"
|
||||
.Ft int
|
||||
.Fn VOP_SETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred" "struct thread *td"
|
||||
.Fn VOP_SETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred"
|
||||
.Sh DESCRIPTION
|
||||
These entry points manipulate various attributes of a file or directory,
|
||||
including file permissions, owner, group, size,
|
||||
@ -55,8 +55,6 @@ The vnode of the file.
|
||||
The attributes of the file.
|
||||
.It Fa cred
|
||||
The user credentials of the calling process.
|
||||
.It Fa td
|
||||
The thread.
|
||||
.El
|
||||
.Pp
|
||||
Attributes which are not being modified by
|
||||
@ -89,9 +87,9 @@ appropriate error is returned.
|
||||
.Sh PSEUDOCODE
|
||||
.Bd -literal
|
||||
int
|
||||
vop_getattr(struct vnode *vp, struct vattr *vap,
|
||||
struct ucred *cred, struct thread *td)
|
||||
vop_getattr(struct vnode *vp, struct vattr *vap, struct ucred *cred)
|
||||
{
|
||||
|
||||
/*
|
||||
* Fill in the contents of *vap with information from
|
||||
* the file system.
|
||||
@ -102,9 +100,9 @@ vop_getattr(struct vnode *vp, struct vattr *vap,
|
||||
}
|
||||
|
||||
int
|
||||
vop_setattr(struct vnode *vp, struct vattr *vap,
|
||||
struct ucred *cred, struct thread *td)
|
||||
vop_setattr(struct vnode *vp, struct vattr *vap, struct ucred *cred)
|
||||
{
|
||||
|
||||
/*
|
||||
* Check for unsettable attributes.
|
||||
*/
|
||||
|
@ -119,12 +119,11 @@ static int
|
||||
kobj_get_filesize_vnode(struct _buf *file, uint64_t *size)
|
||||
{
|
||||
struct vnode *vp = file->ptr;
|
||||
struct thread *td = curthread;
|
||||
struct vattr va;
|
||||
int error;
|
||||
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &va, td->td_ucred, td);
|
||||
error = VOP_GETATTR(vp, &va, curthread->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
if (error == 0)
|
||||
*size = (uint64_t)va.va_size;
|
||||
|
@ -85,7 +85,7 @@ vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift)
|
||||
* Determine the physical size of the file.
|
||||
*/
|
||||
vattr.va_mask = AT_SIZE;
|
||||
error = VOP_GETATTR(vp, &vattr, 0, kcred);
|
||||
error = VOP_GETATTR(vp, &vattr, 0);
|
||||
if (error) {
|
||||
vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
|
||||
return (error);
|
||||
|
@ -358,7 +358,6 @@ zfsctl_root_getattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
@ -799,7 +798,6 @@ zfsctl_snapdir_getattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
@ -924,10 +922,11 @@ zfsctl_snapshot_inactive(ap)
|
||||
}
|
||||
|
||||
static int
|
||||
zfsctl_traverse_begin(vnode_t **vpp, int lktype, kthread_t *td)
|
||||
zfsctl_traverse_begin(vnode_t **vpp, int lktype)
|
||||
{
|
||||
|
||||
VN_HOLD(*vpp);
|
||||
|
||||
/* Snapshot should be already mounted, but just in case. */
|
||||
if (vn_mountedvfs(*vpp) == NULL)
|
||||
return (ENOENT);
|
||||
@ -950,15 +949,14 @@ zfsctl_snapshot_getattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
vnode_t *vp = ap->a_vp;
|
||||
int err;
|
||||
|
||||
err = zfsctl_traverse_begin(&vp, LK_SHARED | LK_RETRY, ap->a_td);
|
||||
err = zfsctl_traverse_begin(&vp, LK_SHARED | LK_RETRY);
|
||||
if (err == 0)
|
||||
err = VOP_GETATTR(vp, ap->a_vap, ap->a_cred, ap->a_td);
|
||||
err = VOP_GETATTR(vp, ap->a_vap, ap->a_cred);
|
||||
zfsctl_traverse_end(vp, err);
|
||||
return (err);
|
||||
}
|
||||
@ -973,7 +971,7 @@ zfsctl_snapshot_fid(ap)
|
||||
vnode_t *vp = ap->a_vp;
|
||||
int err;
|
||||
|
||||
err = zfsctl_traverse_begin(&vp, LK_SHARED | LK_RETRY, curthread);
|
||||
err = zfsctl_traverse_begin(&vp, LK_SHARED | LK_RETRY);
|
||||
if (err == 0)
|
||||
err = VOP_VPTOFH(vp, (void *)ap->a_fid);
|
||||
zfsctl_traverse_end(vp, err);
|
||||
|
@ -361,7 +361,7 @@ zfs_replay_setattr(zfsvfs_t *zfsvfs, lr_setattr_t *lr, boolean_t byteswap)
|
||||
|
||||
vp = ZTOV(zp);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_SETATTR(vp, &va, kcred, curthread);
|
||||
error = VOP_SETATTR(vp, &va, kcred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VN_RELE(vp);
|
||||
|
||||
|
@ -3336,7 +3336,6 @@ zfs_freebsd_getattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
|
||||
@ -3349,7 +3348,6 @@ zfs_freebsd_setattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
vattr_t *vap = ap->a_vap;
|
||||
|
@ -937,7 +937,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
|
||||
vn_fullpath(td, vp, &name, &freename);
|
||||
locked = VFS_LOCK_GIANT(vp->v_mount);
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
VOP_GETATTR(vp, &vat, td->td_ucred, td);
|
||||
VOP_GETATTR(vp, &vat, td->td_ucred);
|
||||
ino = vat.va_fileid;
|
||||
vput(vp);
|
||||
VFS_UNLOCK_GIANT(locked);
|
||||
|
@ -142,7 +142,7 @@ linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, td)
|
||||
* current directory is still locked.
|
||||
*/
|
||||
if (bufp != NULL) {
|
||||
error = VOP_GETATTR(lvp, &va, td->td_ucred, td);
|
||||
error = VOP_GETATTR(lvp, &va, td->td_ucred);
|
||||
if (error) {
|
||||
vput(lvp);
|
||||
*lvpp = NULL;
|
||||
|
@ -277,7 +277,7 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
|
||||
}
|
||||
|
||||
/* Executable? */
|
||||
error = VOP_GETATTR(vp, &attr, td->td_ucred, td);
|
||||
error = VOP_GETATTR(vp, &attr, td->td_ucred);
|
||||
if (error)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -2973,7 +2973,7 @@ NdisOpenFile(status, filehandle, filelength, filename, highestaddr)
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
|
||||
/* Get the file size. */
|
||||
VOP_GETATTR(nd.ni_vp, vap, td->td_ucred, td);
|
||||
VOP_GETATTR(nd.ni_vp, vap, td->td_ucred);
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VFS_UNLOCK_GIANT(vfslocked);
|
||||
|
||||
|
@ -279,7 +279,7 @@ fd_revoke(td, fd)
|
||||
goto out;
|
||||
#endif
|
||||
|
||||
if ((error = VOP_GETATTR(vp, &vattr, td->td_ucred, td)) != 0)
|
||||
if ((error = VOP_GETATTR(vp, &vattr, td->td_ucred)) != 0)
|
||||
goto out;
|
||||
|
||||
if (td->td_ucred->cr_uid != vattr.va_uid &&
|
||||
@ -325,7 +325,7 @@ fd_truncate(td, fd, flp)
|
||||
return ESPIPE;
|
||||
}
|
||||
|
||||
if ((error = VOP_GETATTR(vp, &vattr, td->td_ucred, td)) != 0) {
|
||||
if ((error = VOP_GETATTR(vp, &vattr, td->td_ucred)) != 0) {
|
||||
fdrop(fp, td);
|
||||
return error;
|
||||
}
|
||||
|
@ -928,7 +928,7 @@ mdcreate_vnode(struct md_s *sc, struct md_ioctl *mdio, struct thread *td)
|
||||
vfslocked = NDHASGIANT(&nd);
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
if (nd.ni_vp->v_type != VREG ||
|
||||
(error = VOP_GETATTR(nd.ni_vp, &vattr, td->td_ucred, td))) {
|
||||
(error = VOP_GETATTR(nd.ni_vp, &vattr, td->td_ucred))) {
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
(void)vn_close(nd.ni_vp, flags, td->td_ucred, td);
|
||||
VFS_UNLOCK_GIANT(vfslocked);
|
||||
|
@ -1100,7 +1100,7 @@ open_device(blkif_t *blkif)
|
||||
blkif->csw = dev_refthread(blkif->cdev);
|
||||
PANIC_IF(blkif->csw == NULL);
|
||||
|
||||
err = VOP_GETATTR(blkif->vn, &vattr, NOCRED, curthread);
|
||||
err = VOP_GETATTR(blkif->vn, &vattr, NOCRED);
|
||||
if (err) {
|
||||
xenbus_dev_fatal(blkif->xdev, err,
|
||||
"error getting vnode attributes for device %s", blkif->dev_name);
|
||||
|
@ -86,7 +86,6 @@ cd9660_setattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
@ -182,7 +181,6 @@ cd9660_getattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
|
||||
{
|
||||
@ -217,7 +215,7 @@ cd9660_getattr(ap)
|
||||
auio.uio_offset = 0;
|
||||
auio.uio_rw = UIO_READ;
|
||||
auio.uio_segflg = UIO_SYSSPACE;
|
||||
auio.uio_td = ap->a_td;
|
||||
auio.uio_td = curthread;
|
||||
auio.uio_resid = MAXPATHLEN;
|
||||
rdlnk.a_uio = &auio;
|
||||
rdlnk.a_vp = ap->a_vp;
|
||||
|
@ -304,15 +304,16 @@ venus_ioctl(void *mdp, CodaFid *fid, int com, int flag, caddr_t data,
|
||||
}
|
||||
|
||||
int
|
||||
venus_getattr(void *mdp, CodaFid *fid, struct ucred *cred, struct proc *p,
|
||||
/*out*/ struct vattr *vap)
|
||||
venus_getattr(void *mdp, CodaFid *fid, struct ucred *cred, struct vattr *vap)
|
||||
{
|
||||
struct proc *p;
|
||||
DECL(coda_getattr); /* sets Isize & Osize */
|
||||
ALLOC(coda_getattr); /* sets inp & outp */
|
||||
|
||||
/*
|
||||
* Send the open to venus.
|
||||
*/
|
||||
p = curthread->td_proc;
|
||||
INIT_IN(&inp->ih, CODA_GETATTR, cred, p);
|
||||
inp->Fid = *fid;
|
||||
|
||||
@ -325,15 +326,16 @@ venus_getattr(void *mdp, CodaFid *fid, struct ucred *cred, struct proc *p,
|
||||
}
|
||||
|
||||
int
|
||||
venus_setattr(void *mdp, CodaFid *fid, struct vattr *vap, struct ucred *cred,
|
||||
struct proc *p)
|
||||
venus_setattr(void *mdp, CodaFid *fid, struct vattr *vap, struct ucred *cred)
|
||||
{
|
||||
struct proc *p;
|
||||
DECL_NO_OUT(coda_setattr); /* sets Isize & Osize */
|
||||
ALLOC_NO_OUT(coda_setattr); /* sets inp & outp */
|
||||
|
||||
/*
|
||||
* Send the open to venus.
|
||||
*/
|
||||
p = curthread->td_proc;
|
||||
INIT_IN(&inp->ih, CODA_SETATTR, cred, p);
|
||||
inp->Fid = *fid;
|
||||
CNV_V2VV_ATTR(&inp->attr, vap);
|
||||
|
@ -44,9 +44,9 @@ void venus_write(void);
|
||||
int venus_ioctl(void *mdp, CodaFid *fid, int com, int flag, caddr_t data,
|
||||
struct ucred *cred, struct proc *p);
|
||||
int venus_getattr(void *mdp, CodaFid *fid, struct ucred *cred,
|
||||
struct proc *p, /*out*/ struct vattr *vap);
|
||||
struct vattr *vap);
|
||||
int venus_setattr(void *mdp, CodaFid *fid, struct vattr *vap,
|
||||
struct ucred *cred, struct proc *p);
|
||||
struct ucred *cred);
|
||||
int venus_access(void *mdp, CodaFid *fid, int mode, struct ucred *cred,
|
||||
struct proc *p);
|
||||
int venus_readlink(void *mdp, CodaFid *fid, struct ucred *cred,
|
||||
|
@ -382,7 +382,7 @@ coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag,
|
||||
*/
|
||||
{
|
||||
struct vattr attr;
|
||||
if (VOP_GETATTR(cfvp, &attr, cred, td) == 0)
|
||||
if (VOP_GETATTR(cfvp, &attr, cred) == 0)
|
||||
vnode_pager_setsize(vp, attr.va_size);
|
||||
}
|
||||
}
|
||||
@ -504,7 +504,6 @@ coda_getattr(struct vop_getattr_args *ap)
|
||||
struct cnode *cp = VTOC(vp);
|
||||
struct vattr *vap = ap->a_vap;
|
||||
struct ucred *cred = ap->a_cred;
|
||||
struct thread *td = ap->a_td;
|
||||
/* locals */
|
||||
struct vnode *convp;
|
||||
int error, size;
|
||||
@ -533,7 +532,7 @@ coda_getattr(struct vop_getattr_args *ap)
|
||||
MARK_INT_SAT(CODA_GETATTR_STATS);
|
||||
return (0);
|
||||
}
|
||||
error = venus_getattr(vtomi(vp), &cp->c_fid, cred, td->td_proc, vap);
|
||||
error = venus_getattr(vtomi(vp), &cp->c_fid, cred, vap);
|
||||
if (!error) {
|
||||
CODADEBUG(CODA_GETATTR, myprintf(("getattr miss %s: result "
|
||||
"%d\n", coda_f2s(&cp->c_fid), error)););
|
||||
@ -568,7 +567,6 @@ coda_setattr(struct vop_setattr_args *ap)
|
||||
struct cnode *cp = VTOC(vp);
|
||||
struct vattr *vap = ap->a_vap;
|
||||
struct ucred *cred = ap->a_cred;
|
||||
struct thread *td = ap->a_td;
|
||||
/* locals */
|
||||
struct vnode *convp;
|
||||
int error, size;
|
||||
@ -584,7 +582,7 @@ coda_setattr(struct vop_setattr_args *ap)
|
||||
}
|
||||
if (codadebug & CODADBGMSK(CODA_SETATTR))
|
||||
coda_print_vattr(vap);
|
||||
error = venus_setattr(vtomi(vp), &cp->c_fid, vap, cred, td->td_proc);
|
||||
error = venus_setattr(vtomi(vp), &cp->c_fid, vap, cred);
|
||||
if (!error)
|
||||
cp->c_flags &= ~(C_VATTR | C_ACCCACHE);
|
||||
|
||||
|
@ -1227,12 +1227,14 @@ devfs_setattr(struct vop_setattr_args *ap)
|
||||
struct devfs_dirent *de;
|
||||
struct vattr *vap;
|
||||
struct vnode *vp;
|
||||
struct thread *td;
|
||||
int c, error;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
|
||||
vap = ap->a_vap;
|
||||
vp = ap->a_vp;
|
||||
td = curthread;
|
||||
if ((vap->va_type != VNON) ||
|
||||
(vap->va_nlink != VNOVAL) ||
|
||||
(vap->va_fsid != VNOVAL) ||
|
||||
@ -1261,7 +1263,7 @@ devfs_setattr(struct vop_setattr_args *ap)
|
||||
if (uid != de->de_uid || gid != de->de_gid) {
|
||||
if ((ap->a_cred->cr_uid != de->de_uid) || uid != de->de_uid ||
|
||||
(gid != de->de_gid && !groupmember(gid, ap->a_cred))) {
|
||||
error = priv_check(ap->a_td, PRIV_VFS_CHOWN);
|
||||
error = priv_check(td, PRIV_VFS_CHOWN);
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
@ -1272,7 +1274,7 @@ devfs_setattr(struct vop_setattr_args *ap)
|
||||
|
||||
if (vap->va_mode != (mode_t)VNOVAL) {
|
||||
if (ap->a_cred->cr_uid != de->de_uid) {
|
||||
error = priv_check(ap->a_td, PRIV_VFS_ADMIN);
|
||||
error = priv_check(td, PRIV_VFS_ADMIN);
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
@ -1282,9 +1284,9 @@ devfs_setattr(struct vop_setattr_args *ap)
|
||||
|
||||
if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) {
|
||||
/* See the comment in ufs_vnops::ufs_setattr(). */
|
||||
if ((error = VOP_ACCESS(vp, VADMIN, ap->a_cred, ap->a_td)) &&
|
||||
if ((error = VOP_ACCESS(vp, VADMIN, ap->a_cred, td)) &&
|
||||
((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
|
||||
(error = VOP_ACCESS(vp, VWRITE, ap->a_cred, ap->a_td))))
|
||||
(error = VOP_ACCESS(vp, VWRITE, ap->a_cred, td))))
|
||||
return (error);
|
||||
if (vap->va_atime.tv_sec != VNOVAL) {
|
||||
if (vp->v_type == VCHR)
|
||||
|
@ -379,11 +379,11 @@ fdesc_getattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct vattr *vap = ap->a_vap;
|
||||
struct thread *td = curthread;
|
||||
struct file *fp;
|
||||
struct stat stb;
|
||||
u_int fd;
|
||||
@ -414,12 +414,12 @@ fdesc_getattr(ap)
|
||||
case Fdesc:
|
||||
fd = VTOFDESC(vp)->fd_fd;
|
||||
|
||||
if ((error = fget(ap->a_td, fd, &fp)) != 0)
|
||||
if ((error = fget(td, fd, &fp)) != 0)
|
||||
return (error);
|
||||
|
||||
bzero(&stb, sizeof(stb));
|
||||
error = fo_stat(fp, &stb, ap->a_td->td_ucred, ap->a_td);
|
||||
fdrop(fp, ap->a_td);
|
||||
error = fo_stat(fp, &stb, td->td_ucred, td);
|
||||
fdrop(fp, td);
|
||||
if (error == 0) {
|
||||
VATTR_NULL(vap);
|
||||
vap->va_type = IFTOVT(stb.st_mode);
|
||||
@ -475,13 +475,13 @@ fdesc_setattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vattr *vap = ap->a_vap;
|
||||
struct vnode *vp;
|
||||
struct mount *mp;
|
||||
struct file *fp;
|
||||
struct thread *td = curthread;
|
||||
unsigned fd;
|
||||
int error;
|
||||
|
||||
@ -496,7 +496,7 @@ fdesc_setattr(ap)
|
||||
/*
|
||||
* Allow setattr where there is an underlying vnode.
|
||||
*/
|
||||
error = getvnode(ap->a_td->td_proc->p_fd, fd, &fp);
|
||||
error = getvnode(td->td_proc->p_fd, fd, &fp);
|
||||
if (error) {
|
||||
/*
|
||||
* getvnode() returns EINVAL if the file descriptor is not
|
||||
@ -514,11 +514,11 @@ fdesc_setattr(ap)
|
||||
vp = fp->f_vnode;
|
||||
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) == 0) {
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_SETATTR(vp, ap->a_vap, ap->a_cred, ap->a_td);
|
||||
error = VOP_SETATTR(vp, ap->a_vap, ap->a_cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
vn_finished_write(mp);
|
||||
}
|
||||
fdrop(fp, ap->a_td);
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,6 @@ hpfs_getattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
@ -457,14 +456,13 @@ hpfs_setattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct hpfsnode *hp = VTOHP(vp);
|
||||
struct vattr *vap = ap->a_vap;
|
||||
struct ucred *cred = ap->a_cred;
|
||||
struct thread *td = ap->a_td;
|
||||
struct thread *td = curthread;
|
||||
int error;
|
||||
|
||||
dprintf(("hpfs_setattr(0x%x):\n", hp->h_no));
|
||||
|
@ -289,7 +289,6 @@ msdosfs_getattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct denode *dep = VTODE(ap->a_vp);
|
||||
@ -366,7 +365,6 @@ msdosfs_setattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
@ -374,11 +372,12 @@ msdosfs_setattr(ap)
|
||||
struct msdosfsmount *pmp = dep->de_pmp;
|
||||
struct vattr *vap = ap->a_vap;
|
||||
struct ucred *cred = ap->a_cred;
|
||||
struct thread *td = curthread;
|
||||
int error = 0;
|
||||
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_setattr(): vp %p, vap %p, cred %p, p %p\n",
|
||||
ap->a_vp, vap, cred, ap->a_td);
|
||||
printf("msdosfs_setattr(): vp %p, vap %p, cred %p\n",
|
||||
ap->a_vp, vap, cred);
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -480,7 +479,7 @@ msdosfs_setattr(ap)
|
||||
*/
|
||||
break;
|
||||
}
|
||||
error = detrunc(dep, vap->va_size, 0, cred, ap->a_td);
|
||||
error = detrunc(dep, vap->va_size, 0, cred, td);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
@ -488,12 +487,11 @@ msdosfs_setattr(ap)
|
||||
if (vp->v_mount->mnt_flag & MNT_RDONLY)
|
||||
return (EROFS);
|
||||
if (vap->va_vaflags & VA_UTIMES_NULL) {
|
||||
error = VOP_ACCESS(vp, VADMIN, cred, ap->a_td);
|
||||
error = VOP_ACCESS(vp, VADMIN, cred, td);
|
||||
if (error)
|
||||
error = VOP_ACCESS(vp, VWRITE, cred,
|
||||
ap->a_td);
|
||||
error = VOP_ACCESS(vp, VWRITE, cred, td);
|
||||
} else
|
||||
error = VOP_ACCESS(vp, VADMIN, cred, ap->a_td);
|
||||
error = VOP_ACCESS(vp, VADMIN, cred, td);
|
||||
if (vp->v_type != VDIR) {
|
||||
if ((pmp->pm_flags & MSDOSFSMNT_NOWIN95) == 0 &&
|
||||
vap->va_atime.tv_sec != VNOVAL) {
|
||||
|
@ -178,11 +178,11 @@ nwfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred) {
|
||||
biosize = NWFSTOCONN(nmp)->buffer_size;
|
||||
if (np->n_flag & NMODIFIED) {
|
||||
nwfs_attr_cacheremove(vp);
|
||||
error = VOP_GETATTR(vp, &vattr, cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
if (error) return (error);
|
||||
np->n_mtime = vattr.va_mtime.tv_sec;
|
||||
} else {
|
||||
error = VOP_GETATTR(vp, &vattr, cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
if (error) return (error);
|
||||
if (np->n_mtime != vattr.va_mtime.tv_sec) {
|
||||
error = nwfs_vinvalbuf(vp, td);
|
||||
@ -228,7 +228,7 @@ nwfs_writevnode(vp, uiop, cred, ioflag)
|
||||
* the correct size. */
|
||||
#ifdef notyet
|
||||
nwfs_attr_cacheremove(vp);
|
||||
error = VOP_GETATTR(vp, &vattr, cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
if (error) return (error);
|
||||
#endif
|
||||
uiop->uio_offset = np->n_size;
|
||||
|
@ -175,11 +175,11 @@ nwfs_open(ap)
|
||||
if ((error = nwfs_vinvalbuf(vp, ap->a_td)) == EINTR)
|
||||
return (error);
|
||||
np->n_atime = 0;
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred);
|
||||
if (error) return (error);
|
||||
np->n_mtime = vattr.va_mtime.tv_sec;
|
||||
} else {
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred);
|
||||
if (error) return (error);
|
||||
if (np->n_mtime != vattr.va_mtime.tv_sec) {
|
||||
if ((error = nwfs_vinvalbuf(vp, ap->a_td)) == EINTR)
|
||||
@ -262,13 +262,13 @@ nwfs_getattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct nwnode *np = VTONW(vp);
|
||||
struct vattr *va=ap->a_vap;
|
||||
struct nwmount *nmp = VTONWFS(vp);
|
||||
struct thread *td = curthread;
|
||||
struct nw_entry_info fattr;
|
||||
int error;
|
||||
u_int32_t oldsize;
|
||||
@ -280,10 +280,10 @@ nwfs_getattr(ap)
|
||||
oldsize = np->n_size;
|
||||
if (np->n_flag & NVOLUME) {
|
||||
error = ncp_obtain_info(nmp, np->n_fid.f_id, 0, NULL, &fattr,
|
||||
ap->a_td, ap->a_cred);
|
||||
td, ap->a_cred);
|
||||
} else {
|
||||
error = ncp_obtain_info(nmp, np->n_fid.f_parent, np->n_nmlen,
|
||||
np->n_name, &fattr, ap->a_td, ap->a_cred);
|
||||
np->n_name, &fattr, td, ap->a_cred);
|
||||
}
|
||||
if (error) {
|
||||
NCPVNDEBUG("error %d\n", error);
|
||||
@ -304,7 +304,6 @@ nwfs_setattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
@ -342,13 +341,13 @@ nwfs_setattr(ap)
|
||||
return EINVAL;
|
||||
};
|
||||
}
|
||||
error = ncp_setattr(vp, vap, ap->a_cred, ap->a_td);
|
||||
error = ncp_setattr(vp, vap, ap->a_cred, curthread);
|
||||
if (error && vap->va_size != VNOVAL) {
|
||||
np->n_size = tsize;
|
||||
vnode_pager_setsize(vp, (u_long)tsize);
|
||||
}
|
||||
np->n_atime = 0; /* invalidate cache */
|
||||
VOP_GETATTR(vp, vap, ap->a_cred, ap->a_td);
|
||||
VOP_GETATTR(vp, vap, ap->a_cred);
|
||||
np->n_mtime = vap->va_mtime.tv_sec;
|
||||
return (0);
|
||||
}
|
||||
@ -428,9 +427,8 @@ nwfs_create(ap)
|
||||
*vpp = NULL;
|
||||
if (vap->va_type == VSOCK)
|
||||
return (EOPNOTSUPP);
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread))) {
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)))
|
||||
return (error);
|
||||
}
|
||||
fmode = AR_READ | AR_WRITE;
|
||||
/* if (vap->va_vaflags & VA_EXCLUSIVE)
|
||||
fmode |= AR_DENY_READ | AR_DENY_WRITE;*/
|
||||
@ -636,9 +634,8 @@ nwfs_mkdir(ap)
|
||||
struct vattr vattr;
|
||||
char *name=cnp->cn_nameptr;
|
||||
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread))) {
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)))
|
||||
return (error);
|
||||
}
|
||||
if ((name[0] == '.') && ((len == 1) || ((len == 2) && (name[1] == '.')))) {
|
||||
return EEXIST;
|
||||
}
|
||||
@ -875,7 +872,7 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_vflag & VV_ROOT, (int)flags & ISDO
|
||||
struct vattr vattr;
|
||||
|
||||
vp = *vpp;
|
||||
if (VOP_GETATTR(vp, &vattr, cnp->cn_cred, td) == 0 &&
|
||||
if (!VOP_GETATTR(vp, &vattr, cnp->cn_cred) &&
|
||||
vattr.va_ctime.tv_sec == VTONW(vp)->n_ctime) {
|
||||
if (nameiop != LOOKUP && islastcn)
|
||||
cnp->cn_flags |= SAVENAME;
|
||||
|
@ -447,7 +447,6 @@ portal_getattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
@ -492,7 +491,6 @@ portal_setattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
|
||||
|
@ -128,7 +128,7 @@ pfs_access(struct vop_access_args *va)
|
||||
PFS_TRACE(("%s", pvd->pvd_pn->pn_name));
|
||||
(void)pvd;
|
||||
|
||||
error = VOP_GETATTR(vn, &vattr, va->a_cred, va->a_td);
|
||||
error = VOP_GETATTR(vn, &vattr, va->a_cred);
|
||||
if (error)
|
||||
PFS_RETURN (error);
|
||||
error = vaccess(vn->v_type, vattr.va_mode, vattr.va_uid,
|
||||
@ -227,7 +227,7 @@ pfs_getattr(struct vop_getattr_args *va)
|
||||
vap->va_uid = proc->p_ucred->cr_ruid;
|
||||
vap->va_gid = proc->p_ucred->cr_rgid;
|
||||
if (pn->pn_attr != NULL)
|
||||
error = pn_attr(va->a_td, proc, pn, vap);
|
||||
error = pn_attr(curthread, proc, pn, vap);
|
||||
PROC_UNLOCK(proc);
|
||||
} else {
|
||||
vap->va_uid = 0;
|
||||
|
@ -215,12 +215,12 @@ smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred)
|
||||
/* biosize = SSTOCN(smp->sm_share)->sc_txmax;*/
|
||||
if (np->n_flag & NMODIFIED) {
|
||||
smbfs_attr_cacheremove(vp);
|
||||
error = VOP_GETATTR(vp, &vattr, cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
if (error)
|
||||
return error;
|
||||
np->n_mtime.tv_sec = vattr.va_mtime.tv_sec;
|
||||
} else {
|
||||
error = VOP_GETATTR(vp, &vattr, cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
if (error)
|
||||
return error;
|
||||
if (np->n_mtime.tv_sec != vattr.va_mtime.tv_sec) {
|
||||
@ -269,7 +269,7 @@ smbfs_writevnode(struct vnode *vp, struct uio *uiop,
|
||||
* File size can be changed by another client
|
||||
*/
|
||||
smbfs_attr_cacheremove(vp);
|
||||
error = VOP_GETATTR(vp, &vattr, cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
if (error) return (error);
|
||||
#endif
|
||||
uiop->uio_offset = np->n_size;
|
||||
|
@ -205,7 +205,7 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp,
|
||||
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td) != 0)
|
||||
goto retry;
|
||||
/* Force cached attributes to be refreshed if stale. */
|
||||
(void)VOP_GETATTR(vp, &vattr, td->td_ucred, td);
|
||||
(void)VOP_GETATTR(vp, &vattr, td->td_ucred);
|
||||
/*
|
||||
* If the file type on the server is inconsistent with
|
||||
* what it was when we created the vnode, kill the
|
||||
@ -366,7 +366,7 @@ smbfs_inactive(ap)
|
||||
smb_makescred(&scred, td, cred);
|
||||
smbfs_vinvalbuf(vp, td);
|
||||
if (vp->v_type == VREG) {
|
||||
VOP_GETATTR(vp, &va, cred, td);
|
||||
VOP_GETATTR(vp, &va, cred);
|
||||
smbfs_smb_close(np->n_mount->sm_share, np->n_fid,
|
||||
&np->n_mtime, &scred);
|
||||
} else if (vp->v_type == VDIR) {
|
||||
|
@ -177,12 +177,12 @@ smbfs_open(ap)
|
||||
if ((error = smbfs_vinvalbuf(vp, ap->a_td)) == EINTR)
|
||||
return error;
|
||||
smbfs_attr_cacheremove(vp);
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred);
|
||||
if (error)
|
||||
return error;
|
||||
np->n_mtime.tv_sec = vattr.va_mtime.tv_sec;
|
||||
} else {
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred);
|
||||
if (error)
|
||||
return error;
|
||||
if (np->n_mtime.tv_sec != vattr.va_mtime.tv_sec) {
|
||||
@ -254,7 +254,6 @@ smbfs_getattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
@ -270,7 +269,7 @@ smbfs_getattr(ap)
|
||||
if (!error)
|
||||
return 0;
|
||||
SMBVDEBUG("not in the cache\n");
|
||||
smb_makescred(&scred, ap->a_td, ap->a_cred);
|
||||
smb_makescred(&scred, curthread, ap->a_cred);
|
||||
oldsize = np->n_size;
|
||||
error = smbfs_smb_lookup(np, NULL, 0, &fattr, &scred);
|
||||
if (error) {
|
||||
@ -290,7 +289,6 @@ smbfs_setattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
@ -300,6 +298,7 @@ smbfs_setattr(ap)
|
||||
struct smb_cred scred;
|
||||
struct smb_share *ssp = np->n_mount->sm_share;
|
||||
struct smb_vc *vcp = SSTOVC(ssp);
|
||||
struct thread *td = curthread;
|
||||
u_quad_t tsize = 0;
|
||||
int isreadonly, doclose, error = 0;
|
||||
int old_n_dosattr;
|
||||
@ -315,7 +314,7 @@ smbfs_setattr(ap)
|
||||
vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL ||
|
||||
vap->va_mode != (mode_t)VNOVAL) && isreadonly)
|
||||
return EROFS;
|
||||
smb_makescred(&scred, ap->a_td, ap->a_cred);
|
||||
smb_makescred(&scred, td, ap->a_cred);
|
||||
if (vap->va_size != VNOVAL) {
|
||||
switch (vp->v_type) {
|
||||
case VDIR:
|
||||
@ -367,12 +366,11 @@ smbfs_setattr(ap)
|
||||
atime = &vap->va_atime;
|
||||
if (mtime != atime) {
|
||||
if (vap->va_vaflags & VA_UTIMES_NULL) {
|
||||
error = VOP_ACCESS(vp, VADMIN, ap->a_cred, ap->a_td);
|
||||
error = VOP_ACCESS(vp, VADMIN, ap->a_cred, td);
|
||||
if (error)
|
||||
error = VOP_ACCESS(vp, VWRITE, ap->a_cred,
|
||||
ap->a_td);
|
||||
error = VOP_ACCESS(vp, VWRITE, ap->a_cred, td);
|
||||
} else
|
||||
error = VOP_ACCESS(vp, VADMIN, ap->a_cred, ap->a_td);
|
||||
error = VOP_ACCESS(vp, VADMIN, ap->a_cred, td);
|
||||
#if 0
|
||||
if (mtime == NULL)
|
||||
mtime = &np->n_mtime;
|
||||
@ -385,13 +383,15 @@ smbfs_setattr(ap)
|
||||
*/
|
||||
if ((np->n_flag & NOPEN) == 0) {
|
||||
if (vcp->vc_flags & SMBV_WIN95) {
|
||||
error = VOP_OPEN(vp, FWRITE, ap->a_cred, ap->a_td, NULL);
|
||||
error = VOP_OPEN(vp, FWRITE, ap->a_cred, td,
|
||||
NULL);
|
||||
if (!error) {
|
||||
/* error = smbfs_smb_setfattrNT(np, 0, mtime, atime, &scred);
|
||||
VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);*/
|
||||
if (mtime)
|
||||
np->n_mtime = *mtime;
|
||||
VOP_CLOSE(vp, FWRITE, ap->a_cred, ap->a_td);
|
||||
/* error = smbfs_smb_setfattrNT(np, 0,
|
||||
mtime, atime, &scred);
|
||||
VOP_GETATTR(vp, &vattr, ap->a_cred); */
|
||||
if (mtime)
|
||||
np->n_mtime = *mtime;
|
||||
VOP_CLOSE(vp, FWRITE, ap->a_cred, td);
|
||||
}
|
||||
} else if ((vcp->vc_sopt.sv_caps & SMB_CAP_NT_SMBS)) {
|
||||
error = smbfs_smb_setptime2(np, mtime, atime, 0, &scred);
|
||||
@ -421,7 +421,7 @@ smbfs_setattr(ap)
|
||||
* required attributes.
|
||||
*/
|
||||
smbfs_attr_cacheremove(vp); /* invalidate cache */
|
||||
VOP_GETATTR(vp, vap, ap->a_cred, ap->a_td);
|
||||
VOP_GETATTR(vp, vap, ap->a_cred);
|
||||
np->n_mtime.tv_sec = vap->va_mtime.tv_sec;
|
||||
return error;
|
||||
}
|
||||
@ -497,7 +497,7 @@ smbfs_create(ap)
|
||||
*vpp = NULL;
|
||||
if (vap->va_type != VREG)
|
||||
return EOPNOTSUPP;
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread)))
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)))
|
||||
return error;
|
||||
smb_makescred(&scred, cnp->cn_thread, cnp->cn_cred);
|
||||
|
||||
@ -696,7 +696,7 @@ smbfs_mkdir(ap)
|
||||
int len = cnp->cn_namelen;
|
||||
int error;
|
||||
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread))) {
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred))) {
|
||||
return error;
|
||||
}
|
||||
if ((name[0] == '.') && ((len == 1) || ((len == 2) && (name[1] == '.'))))
|
||||
@ -906,7 +906,7 @@ smbfs_getextattr(struct vop_getextattr_args *ap)
|
||||
error = VOP_ACCESS(vp, VREAD, cred, td);
|
||||
if (error)
|
||||
return error;
|
||||
error = VOP_GETATTR(vp, &vattr, cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
if (error)
|
||||
return error;
|
||||
if (strcmp(name, "dosattr") == 0) {
|
||||
@ -1147,7 +1147,7 @@ smbfs_lookup(ap)
|
||||
|
||||
killit = 0;
|
||||
vp = *vpp;
|
||||
error = VOP_GETATTR(vp, &vattr, cnp->cn_cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cnp->cn_cred);
|
||||
/*
|
||||
* If the file type on the server is inconsistent
|
||||
* with what it was when we created the vnode,
|
||||
|
@ -217,7 +217,7 @@ tmpfs_mount(struct mount *mp, struct thread *td)
|
||||
"feature in FreeBSD.\n");
|
||||
|
||||
vn_lock(mp->mnt_vnodecovered, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(mp->mnt_vnodecovered, &va, mp->mnt_cred, td);
|
||||
error = VOP_GETATTR(mp->mnt_vnodecovered, &va, mp->mnt_cred);
|
||||
VOP_UNLOCK(mp->mnt_vnodecovered, 0);
|
||||
if (error)
|
||||
return (error);
|
||||
|
@ -390,7 +390,7 @@ tmpfs_setattr(struct vop_setattr_args *v)
|
||||
struct vnode *vp = v->a_vp;
|
||||
struct vattr *vap = v->a_vap;
|
||||
struct ucred *cred = v->a_cred;
|
||||
struct thread *l = v->a_td;
|
||||
struct thread *td = curthread;
|
||||
|
||||
int error;
|
||||
|
||||
@ -410,17 +410,16 @@ tmpfs_setattr(struct vop_setattr_args *v)
|
||||
error = EINVAL;
|
||||
|
||||
if (error == 0 && (vap->va_flags != VNOVAL))
|
||||
error = tmpfs_chflags(vp, vap->va_flags, cred, l);
|
||||
error = tmpfs_chflags(vp, vap->va_flags, cred, td);
|
||||
|
||||
if (error == 0 && (vap->va_size != VNOVAL))
|
||||
error = tmpfs_chsize(vp, vap->va_size, cred, l);
|
||||
error = tmpfs_chsize(vp, vap->va_size, cred, td);
|
||||
|
||||
if (error == 0 && (vap->va_uid != VNOVAL || vap->va_gid != VNOVAL))
|
||||
error = tmpfs_chown(vp, vap->va_uid, vap->va_gid, cred,
|
||||
l);
|
||||
error = tmpfs_chown(vp, vap->va_uid, vap->va_gid, cred, td);
|
||||
|
||||
if (error == 0 && (vap->va_mode != (mode_t)VNOVAL))
|
||||
error = tmpfs_chmod(vp, vap->va_mode, cred, l);
|
||||
error = tmpfs_chmod(vp, vap->va_mode, cred, td);
|
||||
|
||||
if (error == 0 && ((vap->va_atime.tv_sec != VNOVAL &&
|
||||
vap->va_atime.tv_nsec != VNOVAL) ||
|
||||
@ -429,7 +428,7 @@ tmpfs_setattr(struct vop_setattr_args *v)
|
||||
(vap->va_birthtime.tv_sec != VNOVAL &&
|
||||
vap->va_birthtime.tv_nsec != VNOVAL)))
|
||||
error = tmpfs_chtimes(vp, &vap->va_atime, &vap->va_mtime,
|
||||
&vap->va_birthtime, vap->va_vaflags, cred, l);
|
||||
&vap->va_birthtime, vap->va_vaflags, cred, td);
|
||||
|
||||
/* Update the node times. We give preference to the error codes
|
||||
* generated by this function rather than the ones that may arise
|
||||
|
@ -523,7 +523,7 @@ unionfs_create_uppervattr(struct unionfs_mount *ump,
|
||||
int error;
|
||||
struct vattr lva;
|
||||
|
||||
if ((error = VOP_GETATTR(lvp, &lva, cred, td)))
|
||||
if ((error = VOP_GETATTR(lvp, &lva, cred)))
|
||||
return (error);
|
||||
|
||||
unionfs_create_uppervattr_core(ump, &lva, uva, td);
|
||||
@ -802,7 +802,7 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp,
|
||||
|
||||
memset(&cn, 0, sizeof(cn));
|
||||
|
||||
if ((error = VOP_GETATTR(lvp, &lva, cnp->cn_cred, td)))
|
||||
if ((error = VOP_GETATTR(lvp, &lva, cnp->cn_cred)))
|
||||
goto unionfs_mkshadowdir_abort;
|
||||
|
||||
if ((error = unionfs_relookup(udvp, &uvp, cnp, &cn, td, cnp->cn_nameptr, cnp->cn_namelen, CREATE)))
|
||||
@ -835,7 +835,7 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp,
|
||||
* Ignore errors.
|
||||
*/
|
||||
va.va_type = VNON;
|
||||
VOP_SETATTR(uvp, &va, cn.cn_cred, td);
|
||||
VOP_SETATTR(uvp, &va, cn.cn_cred);
|
||||
}
|
||||
vn_finished_write(mp);
|
||||
|
||||
@ -931,7 +931,7 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp,
|
||||
fmode = FFLAGS(O_WRONLY | O_CREAT | O_TRUNC | O_EXCL);
|
||||
error = 0;
|
||||
|
||||
if ((error = VOP_GETATTR(lvp, &lva, cred, td)) != 0)
|
||||
if ((error = VOP_GETATTR(lvp, &lva, cred)) != 0)
|
||||
return (error);
|
||||
unionfs_create_uppervattr_core(ump, &lva, uvap, td);
|
||||
|
||||
@ -1119,7 +1119,7 @@ unionfs_copyfile(struct unionfs_node *unp, int docopy, struct ucred *cred,
|
||||
if (error == 0) {
|
||||
/* Reset the attributes. Ignore errors. */
|
||||
uva.va_type = VNON;
|
||||
VOP_SETATTR(uvp, &uva, cred, td);
|
||||
VOP_SETATTR(uvp, &uva, cred);
|
||||
}
|
||||
|
||||
unionfs_node_update(unp, uvp, td);
|
||||
@ -1160,7 +1160,7 @@ unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td)
|
||||
lvp = UNIONFSVPTOLOWERVP(vp);
|
||||
|
||||
/* check opaque */
|
||||
if ((error = VOP_GETATTR(uvp, &va, cred, td)) != 0)
|
||||
if ((error = VOP_GETATTR(uvp, &va, cred)) != 0)
|
||||
return (error);
|
||||
if (va.va_flags & OPAQUE)
|
||||
return (0);
|
||||
|
@ -192,7 +192,7 @@ unionfs_domount(struct mount *mp, struct thread *td)
|
||||
ufile = udir;
|
||||
|
||||
vn_lock(mp->mnt_vnodecovered, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(mp->mnt_vnodecovered, &va, mp->mnt_cred, td);
|
||||
error = VOP_GETATTR(mp->mnt_vnodecovered, &va, mp->mnt_cred);
|
||||
if (!error) {
|
||||
if (udir == 0)
|
||||
udir = va.va_mode;
|
||||
|
@ -206,7 +206,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
|
||||
if (cnp->cn_flags & ISWHITEOUT)
|
||||
iswhiteout = 1; /* don't lookup lower */
|
||||
if (iswhiteout == 0 && ldvp != NULLVP)
|
||||
if (VOP_GETATTR(udvp, &va, cnp->cn_cred, td) == 0 &&
|
||||
if (!VOP_GETATTR(udvp, &va, cnp->cn_cred) &&
|
||||
(va.va_flags & OPAQUE))
|
||||
iswhiteout = 1; /* don't lookup lower */
|
||||
#if 0
|
||||
@ -731,10 +731,10 @@ unionfs_getattr(struct vop_getattr_args *ap)
|
||||
ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount);
|
||||
uvp = unp->un_uppervp;
|
||||
lvp = unp->un_lowervp;
|
||||
td = ap->a_td;
|
||||
td = curthread;
|
||||
|
||||
if (uvp != NULLVP) {
|
||||
if ((error = VOP_GETATTR(uvp, ap->a_vap, ap->a_cred, td)) == 0)
|
||||
if ((error = VOP_GETATTR(uvp, ap->a_vap, ap->a_cred)) == 0)
|
||||
ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
|
||||
|
||||
UNIONFS_INTERNAL_DEBUG("unionfs_getattr: leave mode=%o, uid=%d, gid=%d (%d)\n",
|
||||
@ -744,7 +744,7 @@ unionfs_getattr(struct vop_getattr_args *ap)
|
||||
return (error);
|
||||
}
|
||||
|
||||
error = VOP_GETATTR(lvp, ap->a_vap, ap->a_cred, td);
|
||||
error = VOP_GETATTR(lvp, ap->a_vap, ap->a_cred);
|
||||
|
||||
if (error == 0 && !(ump->um_uppervp->v_mount->mnt_flag & MNT_RDONLY)) {
|
||||
/* correct the attr toward shadow file/dir. */
|
||||
@ -781,7 +781,7 @@ unionfs_setattr(struct vop_setattr_args *ap)
|
||||
unp = VTOUNIONFS(ap->a_vp);
|
||||
uvp = unp->un_uppervp;
|
||||
lvp = unp->un_lowervp;
|
||||
td = ap->a_td;
|
||||
td = curthread;
|
||||
vap = ap->a_vap;
|
||||
|
||||
if ((ap->a_vp->v_mount->mnt_flag & MNT_RDONLY) &&
|
||||
@ -799,7 +799,7 @@ unionfs_setattr(struct vop_setattr_args *ap)
|
||||
}
|
||||
|
||||
if (uvp != NULLVP)
|
||||
error = VOP_SETATTR(uvp, vap, ap->a_cred, td);
|
||||
error = VOP_SETATTR(uvp, vap, ap->a_cred);
|
||||
|
||||
UNIONFS_INTERNAL_DEBUG("unionfs_setattr: leave (%d)\n", error);
|
||||
|
||||
@ -1264,7 +1264,7 @@ unionfs_mkdir(struct vop_mkdir_args *ap)
|
||||
if (udvp != NULLVP) {
|
||||
/* check opaque */
|
||||
if (!(cnp->cn_flags & ISWHITEOUT)) {
|
||||
error = VOP_GETATTR(udvp, &va, cnp->cn_cred, td);
|
||||
error = VOP_GETATTR(udvp, &va, cnp->cn_cred);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
if (va.va_flags & OPAQUE)
|
||||
@ -1412,7 +1412,7 @@ unionfs_readdir(struct vop_readdir_args *ap)
|
||||
|
||||
/* check opaque */
|
||||
if (uvp != NULLVP && lvp != NULLVP) {
|
||||
if ((error = VOP_GETATTR(uvp, &va, ap->a_cred, td)) != 0)
|
||||
if ((error = VOP_GETATTR(uvp, &va, ap->a_cred)) != 0)
|
||||
goto unionfs_readdir_exit;
|
||||
if (va.va_flags & OPAQUE)
|
||||
lvp = NULLVP;
|
||||
|
@ -335,7 +335,6 @@ ext2_getattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
@ -378,14 +377,13 @@ ext2_setattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vattr *vap = ap->a_vap;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct inode *ip = VTOI(vp);
|
||||
struct ucred *cred = ap->a_cred;
|
||||
struct thread *td = ap->a_td;
|
||||
struct thread *td = curthread;
|
||||
int error;
|
||||
|
||||
/*
|
||||
|
@ -230,7 +230,6 @@ _xfs_getattr(
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap)
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
@ -293,7 +292,6 @@ _xfs_setattr(
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap)
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
|
@ -188,7 +188,7 @@ coff_load_file(struct thread *td, char *name)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ((error = VOP_GETATTR(vp, &attr, td->td_ucred, td)) != 0)
|
||||
if ((error = VOP_GETATTR(vp, &attr, td->td_ucred)) != 0)
|
||||
goto fail;
|
||||
|
||||
if ((vp->v_mount->mnt_flag & MNT_NOEXEC)
|
||||
|
@ -121,7 +121,7 @@ exec_shell_imgact(imgp)
|
||||
* valid -- the actual file might be much shorter than the page.
|
||||
* So find out the file size.
|
||||
*/
|
||||
error = VOP_GETATTR(imgp->vp, &vattr, imgp->proc->p_ucred, curthread);
|
||||
error = VOP_GETATTR(imgp->vp, &vattr, imgp->proc->p_ucred);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -797,7 +797,7 @@ do_execve(td, args, mac_p)
|
||||
exec_setregs(td, imgp->entry_addr,
|
||||
(u_long)(uintptr_t)stack_base, imgp->ps_strings);
|
||||
|
||||
vfs_mark_atime(imgp->vp, td);
|
||||
vfs_mark_atime(imgp->vp, td->td_ucred);
|
||||
|
||||
done1:
|
||||
|
||||
@ -1287,7 +1287,7 @@ exec_check_permissions(imgp)
|
||||
td = curthread;
|
||||
|
||||
/* Get file attributes */
|
||||
error = VOP_GETATTR(vp, attr, td->td_ucred, td);
|
||||
error = VOP_GETATTR(vp, attr, td->td_ucred);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1638,7 +1638,7 @@ linker_lookup_file(const char *path, int pathlen, const char *name,
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
type = nd.ni_vp->v_type;
|
||||
if (vap)
|
||||
VOP_GETATTR(nd.ni_vp, vap, td->td_ucred, td);
|
||||
VOP_GETATTR(nd.ni_vp, vap, td->td_ucred);
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
|
||||
VFS_UNLOCK_GIANT(vfslocked);
|
||||
@ -1691,7 +1691,7 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname,
|
||||
if (nd.ni_vp->v_type != VREG)
|
||||
goto bad;
|
||||
best = cp = NULL;
|
||||
error = VOP_GETATTR(nd.ni_vp, &vattr, cred, td);
|
||||
error = VOP_GETATTR(nd.ni_vp, &vattr, cred);
|
||||
if (error)
|
||||
goto bad;
|
||||
/*
|
||||
|
@ -2962,7 +2962,7 @@ coredump(struct thread *td)
|
||||
|
||||
/* Don't dump to non-regular files or files with links. */
|
||||
if (vp->v_type != VREG ||
|
||||
VOP_GETATTR(vp, &vattr, cred, td) || vattr.va_nlink != 1) {
|
||||
VOP_GETATTR(vp, &vattr, cred) || vattr.va_nlink != 1) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
error = EFAULT;
|
||||
goto close;
|
||||
@ -2993,7 +2993,7 @@ coredump(struct thread *td)
|
||||
vattr.va_flags = UF_NODUMP;
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
VOP_LEASE(vp, td, cred, LEASE_WRITE);
|
||||
VOP_SETATTR(vp, &vattr, cred, td);
|
||||
VOP_SETATTR(vp, &vattr, cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
vn_finished_write(mp);
|
||||
PROC_LOCK(p);
|
||||
|
@ -1100,7 +1100,7 @@ mqfs_access(struct vop_access_args *ap)
|
||||
struct vattr vattr;
|
||||
int error;
|
||||
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred);
|
||||
if (error)
|
||||
return (error);
|
||||
error = vaccess(vp->v_type, vattr.va_mode, vattr.va_uid,
|
||||
@ -1114,7 +1114,6 @@ struct vop_getattr_args {
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -1159,7 +1158,6 @@ struct vop_setattr_args {
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
};
|
||||
#endif
|
||||
/*
|
||||
@ -1171,10 +1169,12 @@ mqfs_setattr(struct vop_setattr_args *ap)
|
||||
struct mqfs_node *pn;
|
||||
struct vattr *vap;
|
||||
struct vnode *vp;
|
||||
struct thread *td;
|
||||
int c, error;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
|
||||
td = curthread;
|
||||
vap = ap->a_vap;
|
||||
vp = ap->a_vp;
|
||||
if ((vap->va_type != VNON) ||
|
||||
@ -1206,7 +1206,7 @@ mqfs_setattr(struct vop_setattr_args *ap)
|
||||
* To modify the ownership of a file, must possess VADMIN
|
||||
* for that file.
|
||||
*/
|
||||
if ((error = VOP_ACCESS(vp, VADMIN, ap->a_cred, ap->a_td)))
|
||||
if ((error = VOP_ACCESS(vp, VADMIN, ap->a_cred, td)))
|
||||
return (error);
|
||||
|
||||
/*
|
||||
@ -1216,7 +1216,7 @@ mqfs_setattr(struct vop_setattr_args *ap)
|
||||
*/
|
||||
if (((ap->a_cred->cr_uid != pn->mn_uid) || uid != pn->mn_uid ||
|
||||
(gid != pn->mn_gid && !groupmember(gid, ap->a_cred))) &&
|
||||
(error = priv_check(ap->a_td, PRIV_MQ_ADMIN)) != 0)
|
||||
(error = priv_check(td, PRIV_MQ_ADMIN)) != 0)
|
||||
return (error);
|
||||
pn->mn_uid = uid;
|
||||
pn->mn_gid = gid;
|
||||
@ -1225,7 +1225,7 @@ mqfs_setattr(struct vop_setattr_args *ap)
|
||||
|
||||
if (vap->va_mode != (mode_t)VNOVAL) {
|
||||
if ((ap->a_cred->cr_uid != pn->mn_uid) &&
|
||||
(error = priv_check(ap->a_td, PRIV_MQ_ADMIN)))
|
||||
(error = priv_check(td, PRIV_MQ_ADMIN)))
|
||||
return (error);
|
||||
pn->mn_mode = vap->va_mode;
|
||||
c = 1;
|
||||
@ -1233,9 +1233,9 @@ mqfs_setattr(struct vop_setattr_args *ap)
|
||||
|
||||
if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) {
|
||||
/* See the comment in ufs_vnops::ufs_setattr(). */
|
||||
if ((error = VOP_ACCESS(vp, VADMIN, ap->a_cred, ap->a_td)) &&
|
||||
if ((error = VOP_ACCESS(vp, VADMIN, ap->a_cred, td)) &&
|
||||
((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
|
||||
(error = VOP_ACCESS(vp, VWRITE, ap->a_cred, ap->a_td))))
|
||||
(error = VOP_ACCESS(vp, VWRITE, ap->a_cred, td))))
|
||||
return (error);
|
||||
if (vap->va_atime.tv_sec != VNOVAL) {
|
||||
pn->mn_atime = vap->va_atime;
|
||||
|
@ -208,13 +208,15 @@ vop_nostrategy (struct vop_strategy_args *ap)
|
||||
int
|
||||
vop_stdadvlock(struct vop_advlock_args *ap)
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct thread *td = curthread;
|
||||
struct vnode *vp;
|
||||
struct ucred *cred;
|
||||
struct vattr vattr;
|
||||
int error;
|
||||
|
||||
vp = ap->a_vp;
|
||||
cred = curthread->td_ucred;
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, td->td_ucred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
if (error)
|
||||
return (error);
|
||||
@ -225,13 +227,15 @@ vop_stdadvlock(struct vop_advlock_args *ap)
|
||||
int
|
||||
vop_stdadvlockasync(struct vop_advlockasync_args *ap)
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct thread *td = curthread;
|
||||
struct vnode *vp;
|
||||
struct ucred *cred;
|
||||
struct vattr vattr;
|
||||
int error;
|
||||
|
||||
vp = ap->a_vp;
|
||||
cred = curthread->td_ucred;
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, td->td_ucred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
if (error)
|
||||
return (error);
|
||||
|
@ -958,7 +958,7 @@ vfs_domount(
|
||||
* If the user is not root, ensure that they own the directory
|
||||
* onto which we are attempting to mount.
|
||||
*/
|
||||
error = VOP_GETATTR(vp, &va, td->td_ucred, td);
|
||||
error = VOP_GETATTR(vp, &va, td->td_ucred);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
return (error);
|
||||
|
@ -2379,7 +2379,7 @@ vflush( struct mount *mp, int rootrefs, int flags, struct thread *td)
|
||||
* vnodes open for writing.
|
||||
*/
|
||||
if (flags & WRITECLOSE) {
|
||||
error = VOP_GETATTR(vp, &vattr, td->td_ucred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, td->td_ucred);
|
||||
VI_LOCK(vp);
|
||||
|
||||
if ((vp->v_type == VNON ||
|
||||
@ -4111,7 +4111,7 @@ filt_vfsread(struct knote *kn, long hint)
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (VOP_GETATTR(vp, &va, curthread->td_ucred, curthread))
|
||||
if (VOP_GETATTR(vp, &va, curthread->td_ucred))
|
||||
return (0);
|
||||
|
||||
kn->kn_data = va.va_size - kn->kn_fp->f_offset;
|
||||
@ -4181,13 +4181,13 @@ vfs_read_dirent(struct vop_readdir_args *ap, struct dirent *dp, off_t off)
|
||||
* directly setting va_atime for the sake of efficiency.
|
||||
*/
|
||||
void
|
||||
vfs_mark_atime(struct vnode *vp, struct thread *td)
|
||||
vfs_mark_atime(struct vnode *vp, struct ucred *cred)
|
||||
{
|
||||
struct vattr atimeattr;
|
||||
|
||||
if ((vp->v_mount->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0) {
|
||||
VATTR_NULL(&atimeattr);
|
||||
atimeattr.va_vaflags |= VA_MARK_ATIME;
|
||||
(void)VOP_SETATTR(vp, &atimeattr, td->td_ucred, td);
|
||||
(void)VOP_SETATTR(vp, &atimeattr, cred);
|
||||
}
|
||||
}
|
||||
|
@ -1147,7 +1147,7 @@ kern_openat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
|
||||
error = mac_vnode_check_write(td->td_ucred, fp->f_cred, vp);
|
||||
if (error == 0)
|
||||
#endif
|
||||
error = VOP_SETATTR(vp, &vat, td->td_ucred, td);
|
||||
error = VOP_SETATTR(vp, &vat, td->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
vn_finished_write(mp);
|
||||
if (error)
|
||||
@ -1507,7 +1507,7 @@ SYSCTL_INT(_security_bsd, OID_AUTO, hardlink_check_gid, CTLFLAG_RW,
|
||||
"groups");
|
||||
|
||||
static int
|
||||
can_hardlink(struct vnode *vp, struct thread *td, struct ucred *cred)
|
||||
can_hardlink(struct vnode *vp, struct ucred *cred)
|
||||
{
|
||||
struct vattr va;
|
||||
int error;
|
||||
@ -1515,7 +1515,7 @@ can_hardlink(struct vnode *vp, struct thread *td, struct ucred *cred)
|
||||
if (!hardlink_check_uid && !hardlink_check_gid)
|
||||
return (0);
|
||||
|
||||
error = VOP_GETATTR(vp, &va, cred, td);
|
||||
error = VOP_GETATTR(vp, &va, cred);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
@ -1586,7 +1586,7 @@ kern_linkat(struct thread *td, int fd1, int fd2, char *path1, char *path2,
|
||||
== 0) {
|
||||
VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
|
||||
VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
|
||||
error = can_hardlink(vp, td, td->td_ucred);
|
||||
error = can_hardlink(vp, td->td_ucred);
|
||||
if (error == 0)
|
||||
#ifdef MAC
|
||||
error = mac_vnode_check_link(td->td_ucred,
|
||||
@ -1939,7 +1939,7 @@ lseek(td, uap)
|
||||
break;
|
||||
case L_XTND:
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
if (error)
|
||||
break;
|
||||
@ -2637,7 +2637,7 @@ setfflags(td, vp, flags)
|
||||
error = mac_vnode_check_setflags(td->td_ucred, vp, vattr.va_flags);
|
||||
if (error == 0)
|
||||
#endif
|
||||
error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
|
||||
error = VOP_SETATTR(vp, &vattr, td->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
vn_finished_write(mp);
|
||||
return (error);
|
||||
@ -2765,7 +2765,7 @@ setfmode(td, vp, mode)
|
||||
error = mac_vnode_check_setmode(td->td_ucred, vp, vattr.va_mode);
|
||||
if (error == 0)
|
||||
#endif
|
||||
error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
|
||||
error = VOP_SETATTR(vp, &vattr, td->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
vn_finished_write(mp);
|
||||
return (error);
|
||||
@ -2930,7 +2930,7 @@ setfown(td, vp, uid, gid)
|
||||
vattr.va_gid);
|
||||
if (error == 0)
|
||||
#endif
|
||||
error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
|
||||
error = VOP_SETATTR(vp, &vattr, td->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
vn_finished_write(mp);
|
||||
return (error);
|
||||
@ -3137,7 +3137,7 @@ setutimes(td, vp, ts, numtimes, nullflag)
|
||||
VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
setbirthtime = 0;
|
||||
if (numtimes < 3 && VOP_GETATTR(vp, &vattr, td->td_ucred, td) == 0 &&
|
||||
if (numtimes < 3 && !VOP_GETATTR(vp, &vattr, td->td_ucred) &&
|
||||
timespeccmp(&ts[1], &vattr.va_birthtime, < ))
|
||||
setbirthtime = 1;
|
||||
VATTR_NULL(&vattr);
|
||||
@ -3154,7 +3154,7 @@ setutimes(td, vp, ts, numtimes, nullflag)
|
||||
vattr.va_mtime);
|
||||
#endif
|
||||
if (error == 0)
|
||||
error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
|
||||
error = VOP_SETATTR(vp, &vattr, td->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
vn_finished_write(mp);
|
||||
return (error);
|
||||
@ -3377,7 +3377,7 @@ kern_truncate(struct thread *td, char *path, enum uio_seg pathseg, off_t length)
|
||||
(error = VOP_ACCESS(vp, VWRITE, td->td_ucred, td)) == 0) {
|
||||
VATTR_NULL(&vattr);
|
||||
vattr.va_size = length;
|
||||
error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
|
||||
error = VOP_SETATTR(vp, &vattr, td->td_ucred);
|
||||
}
|
||||
vput(vp);
|
||||
vn_finished_write(mp);
|
||||
@ -4172,7 +4172,7 @@ revoke(td, uap)
|
||||
if (error)
|
||||
goto out;
|
||||
#endif
|
||||
error = VOP_GETATTR(vp, &vattr, td->td_ucred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, td->td_ucred);
|
||||
if (error)
|
||||
goto out;
|
||||
if (td->td_ucred->cr_uid != vattr.va_uid) {
|
||||
@ -4418,7 +4418,7 @@ fhopen(td, uap)
|
||||
#endif
|
||||
VATTR_NULL(vap);
|
||||
vap->va_size = 0;
|
||||
error = VOP_SETATTR(vp, vap, td->td_ucred, td);
|
||||
error = VOP_SETATTR(vp, vap, td->td_ucred);
|
||||
#ifdef MAC
|
||||
}
|
||||
#endif
|
||||
|
@ -648,7 +648,7 @@ vn_truncate(fp, length, active_cred, td)
|
||||
if (error == 0) {
|
||||
VATTR_NULL(&vattr);
|
||||
vattr.va_size = length;
|
||||
error = VOP_SETATTR(vp, &vattr, fp->f_cred, td);
|
||||
error = VOP_SETATTR(vp, &vattr, fp->f_cred);
|
||||
}
|
||||
out:
|
||||
VOP_UNLOCK(vp, 0);
|
||||
@ -703,7 +703,7 @@ vn_stat(vp, sb, active_cred, file_cred, td)
|
||||
#endif
|
||||
|
||||
vap = &vattr;
|
||||
error = VOP_GETATTR(vp, vap, active_cred, td);
|
||||
error = VOP_GETATTR(vp, vap, active_cred);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
@ -803,7 +803,7 @@ vn_ioctl(fp, com, data, active_cred, td)
|
||||
case VDIR:
|
||||
if (com == FIONREAD) {
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, active_cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, active_cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
if (!error)
|
||||
*(int *)data = vattr.va_size - fp->f_offset;
|
||||
|
@ -159,7 +159,6 @@ vop_getattr {
|
||||
IN struct vnode *vp;
|
||||
OUT struct vattr *vap;
|
||||
IN struct ucred *cred;
|
||||
IN struct thread *td;
|
||||
};
|
||||
|
||||
|
||||
@ -170,7 +169,6 @@ vop_setattr {
|
||||
IN struct vnode *vp;
|
||||
IN struct vattr *vap;
|
||||
IN struct ucred *cred;
|
||||
IN struct thread *td;
|
||||
};
|
||||
|
||||
|
||||
|
@ -128,9 +128,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
static int nfs4_flush(struct vnode *, int, struct thread *,
|
||||
int);
|
||||
static int nfs4_setattrrpc(struct vnode *, struct vattr *, struct ucred *,
|
||||
struct thread *);
|
||||
static int nfs4_closerpc(struct vnode *, struct ucred *, struct thread *, int);
|
||||
static int nfs4_setattrrpc(struct vnode *, struct vattr *, struct ucred *);
|
||||
static int nfs4_closerpc(struct vnode *, struct ucred *, int);
|
||||
|
||||
static vop_lookup_t nfs4_lookup;
|
||||
static vop_create_t nfs4_create;
|
||||
@ -528,8 +527,7 @@ nfs4_openrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
|
||||
|
||||
VATTR_NULL(&va);
|
||||
va.va_size = 0;
|
||||
error = nfs4_setattrrpc(vp, &va,
|
||||
cnp->cn_cred, cnp->cn_thread);
|
||||
error = nfs4_setattrrpc(vp, &va, cnp->cn_cred);
|
||||
}
|
||||
np->n_attrstamp = 0;
|
||||
}
|
||||
@ -621,15 +619,17 @@ nfs4_open(struct vop_open_args *ap)
|
||||
}
|
||||
|
||||
static int
|
||||
nfs4_closerpc(struct vnode *vp, struct ucred *cred, struct thread *td, int flags)
|
||||
nfs4_closerpc(struct vnode *vp, struct ucred *cred, int flags)
|
||||
{
|
||||
caddr_t bpos, dpos;
|
||||
int error = 0;
|
||||
struct mbuf *mreq, *mrep = NULL, *md, *mb;
|
||||
struct thread *td;
|
||||
struct nfs4_fctx *fcp;
|
||||
struct nfs4_compound cp;
|
||||
struct nfsnode *np = VTONFS(vp);
|
||||
|
||||
td = curthread;
|
||||
fcp = flags & FWRITE ? &np->n_wfc : &np->n_rfc;
|
||||
|
||||
nfs_v4initcompound(&cp);
|
||||
@ -687,7 +687,7 @@ nfs4_close(struct vop_close_args *ap)
|
||||
np->n_attrstamp = 0;
|
||||
}
|
||||
|
||||
error = nfs4_closerpc(vp, ap->a_cred, ap->a_td, ap->a_fflag);
|
||||
error = nfs4_closerpc(vp, ap->a_cred, ap->a_fflag);
|
||||
|
||||
if (!error && np->n_flag & NWRITEERR) {
|
||||
np->n_flag &= ~NWRITEERR;
|
||||
@ -735,7 +735,7 @@ nfs4_getattr(struct vop_getattr_args *ap)
|
||||
nfsm_v4build_getattr(&cp, &ga);
|
||||
nfsm_v4build_finalize(&cp);
|
||||
|
||||
nfsm_request(vp, NFSV4PROC_COMPOUND, ap->a_td, ap->a_cred);
|
||||
nfsm_request(vp, NFSV4PROC_COMPOUND, curthread, ap->a_cred);
|
||||
if (error != 0)
|
||||
goto nfsmout;
|
||||
|
||||
@ -762,6 +762,7 @@ nfs4_setattr(struct vop_setattr_args *ap)
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct nfsnode *np = VTONFS(vp);
|
||||
struct vattr *vap = ap->a_vap;
|
||||
struct thread *td = curthread;
|
||||
int error = 0;
|
||||
u_quad_t tsize;
|
||||
|
||||
@ -815,14 +816,14 @@ nfs4_setattr(struct vop_setattr_args *ap)
|
||||
*/
|
||||
|
||||
tsize = np->n_size;
|
||||
error = nfs_meta_setsize(vp, ap->a_cred,
|
||||
ap->a_td, vap->va_size);
|
||||
error = nfs_meta_setsize(vp, ap->a_cred, td,
|
||||
vap->va_size);
|
||||
|
||||
if (np->n_flag & NMODIFIED) {
|
||||
if (vap->va_size == 0)
|
||||
error = nfs_vinvalbuf(vp, 0, ap->a_td, 1);
|
||||
error = nfs_vinvalbuf(vp, 0, td, 1);
|
||||
else
|
||||
error = nfs_vinvalbuf(vp, V_SAVE, ap->a_td, 1);
|
||||
error = nfs_vinvalbuf(vp, V_SAVE, td, 1);
|
||||
if (error) {
|
||||
vnode_pager_setsize(vp, np->n_size);
|
||||
return (error);
|
||||
@ -839,7 +840,7 @@ nfs4_setattr(struct vop_setattr_args *ap)
|
||||
} else if ((vap->va_mtime.tv_sec != VNOVAL ||
|
||||
vap->va_atime.tv_sec != VNOVAL) && (np->n_flag & NMODIFIED) &&
|
||||
vp->v_type == VREG &&
|
||||
(error = nfs_vinvalbuf(vp, V_SAVE, ap->a_td, 1)) == EINTR)
|
||||
(error = nfs_vinvalbuf(vp, V_SAVE, td, 1)) == EINTR)
|
||||
return (error);
|
||||
|
||||
if (vap->va_size != VNOVAL && np->n_wfc.refcnt == 0) {
|
||||
@ -849,14 +850,14 @@ nfs4_setattr(struct vop_setattr_args *ap)
|
||||
cn.cn_nameptr = np->n_name;
|
||||
cn.cn_namelen = np->n_namelen;
|
||||
cn.cn_cred = ap->a_cred;
|
||||
cn.cn_thread = ap->a_td;
|
||||
cn.cn_thread = td;
|
||||
error = nfs4_openrpc(np->n_dvp, &vp, &cn, FWRITE, NULL);
|
||||
if (error)
|
||||
return error;
|
||||
np->n_flag |= NTRUNCATE;
|
||||
}
|
||||
|
||||
error = nfs4_setattrrpc(vp, vap, ap->a_cred, ap->a_td);
|
||||
error = nfs4_setattrrpc(vp, vap, ap->a_cred);
|
||||
if (error && vap->va_size != VNOVAL) {
|
||||
np->n_size = np->n_vattr.va_size = tsize;
|
||||
vnode_pager_setsize(vp, np->n_size);
|
||||
@ -868,17 +869,18 @@ nfs4_setattr(struct vop_setattr_args *ap)
|
||||
* Do an nfs setattr rpc.
|
||||
*/
|
||||
static int
|
||||
nfs4_setattrrpc(struct vnode *vp, struct vattr *vap, struct ucred *cred,
|
||||
struct thread *td)
|
||||
nfs4_setattrrpc(struct vnode *vp, struct vattr *vap, struct ucred *cred)
|
||||
{
|
||||
caddr_t bpos, dpos;
|
||||
int error = 0;
|
||||
struct mbuf *mreq, *mrep = NULL, *md, *mb;
|
||||
struct thread *td;
|
||||
struct nfs4_compound cp;
|
||||
struct nfs4_oparg_getattr ga;
|
||||
struct nfsnode *np = VTONFS(vp);
|
||||
struct nfs4_fctx *fcp;
|
||||
|
||||
td = curthread;
|
||||
nfsstats.rpccnt[NFSPROC_SETATTR]++;
|
||||
mreq = nfsm_reqhead(vp, NFSV4PROC_COMPOUND, 0);
|
||||
mb = mreq;
|
||||
@ -907,7 +909,7 @@ nfs4_setattrrpc(struct vnode *vp, struct vattr *vap, struct ucred *cred,
|
||||
|
||||
/* TODO: do the settatr and close in a single compound rpc */
|
||||
if (np->n_flag & NTRUNCATE) {
|
||||
error = nfs4_closerpc(vp, cred, td, FWRITE);
|
||||
error = nfs4_closerpc(vp, cred, FWRITE);
|
||||
np->n_flag &= ~NTRUNCATE;
|
||||
}
|
||||
|
||||
@ -965,7 +967,7 @@ nfs4_lookup(struct vop_lookup_args *ap)
|
||||
struct vattr vattr;
|
||||
|
||||
newvp = *vpp;
|
||||
if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, td)
|
||||
if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred)
|
||||
&& vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) {
|
||||
nfsstats.lookupcache_hits++;
|
||||
if (cnp->cn_nameiop != LOOKUP &&
|
||||
@ -1532,7 +1534,7 @@ nfs4_create(struct vop_create_args *ap)
|
||||
int error = 0, fmode = (O_CREAT | FREAD | FWRITE);
|
||||
struct vattr vattr;
|
||||
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread)) != 0)
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)) != 0)
|
||||
return (error);
|
||||
|
||||
if (vap->va_vaflags & VA_EXCLUSIVE)
|
||||
@ -1586,8 +1588,7 @@ nfs4_remove(struct vop_remove_args *ap)
|
||||
if (vp->v_type == VDIR)
|
||||
error = EPERM;
|
||||
else if (vrefcnt(vp) == 1 || (np->n_sillyrename &&
|
||||
VOP_GETATTR(vp, &vattr, cnp->cn_cred, cnp->cn_thread) == 0 &&
|
||||
vattr.va_nlink > 1)) {
|
||||
!VOP_GETATTR(vp, &vattr, cnp->cn_cred) && vattr.va_nlink > 1)) {
|
||||
/*
|
||||
* Purge the name cache so that the chance of a lookup for
|
||||
* the name succeeding while the remove is in progress is
|
||||
@ -1925,7 +1926,7 @@ nfs4_readdir(struct vop_readdir_args *ap)
|
||||
*/
|
||||
if (np->n_direofoffset > 0 && uio->uio_offset >= np->n_direofoffset &&
|
||||
(np->n_flag & NMODIFIED) == 0) {
|
||||
if (VOP_GETATTR(vp, &vattr, ap->a_cred, uio->uio_td) == 0 &&
|
||||
if (!VOP_GETATTR(vp, &vattr, ap->a_cred) &&
|
||||
!NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime)) {
|
||||
nfsstats.direofcache_hits++;
|
||||
return (0);
|
||||
|
@ -403,7 +403,7 @@ nfs_bioread_check_cons(struct vnode *vp, struct thread *td, struct ucred *cred)
|
||||
goto out;
|
||||
}
|
||||
np->n_attrstamp = 0;
|
||||
error = VOP_GETATTR(vp, &vattr, cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
if (error)
|
||||
goto out;
|
||||
mtx_lock(&np->n_mtx);
|
||||
@ -411,7 +411,7 @@ nfs_bioread_check_cons(struct vnode *vp, struct thread *td, struct ucred *cred)
|
||||
mtx_unlock(&np->n_mtx);
|
||||
} else {
|
||||
mtx_unlock(&np->n_mtx);
|
||||
error = VOP_GETATTR(vp, &vattr, cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
if (error)
|
||||
return (error);
|
||||
mtx_lock(&np->n_mtx);
|
||||
@ -928,7 +928,7 @@ nfs_write(struct vop_write_args *ap)
|
||||
*/
|
||||
if (ioflag & IO_APPEND) {
|
||||
np->n_attrstamp = 0;
|
||||
error = VOP_GETATTR(vp, &vattr, cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
if (error)
|
||||
return (error);
|
||||
mtx_lock(&np->n_mtx);
|
||||
|
@ -982,7 +982,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
|
||||
if (argp->flags & NFSMNT_NFSV3)
|
||||
nfs_fsinfo(nmp, *vpp, curthread->td_ucred, curthread);
|
||||
else
|
||||
VOP_GETATTR(*vpp, &attrs, curthread->td_ucred, curthread);
|
||||
VOP_GETATTR(*vpp, &attrs, curthread->td_ucred);
|
||||
|
||||
/*
|
||||
* Lose the lock but keep the ref.
|
||||
|
@ -100,10 +100,8 @@ __FBSDID("$FreeBSD$");
|
||||
static vop_read_t nfsfifo_read;
|
||||
static vop_write_t nfsfifo_write;
|
||||
static vop_close_t nfsfifo_close;
|
||||
static int nfs_flush(struct vnode *, int, struct thread *,
|
||||
int);
|
||||
static int nfs_setattrrpc(struct vnode *, struct vattr *, struct ucred *,
|
||||
struct thread *);
|
||||
static int nfs_flush(struct vnode *, int, int);
|
||||
static int nfs_setattrrpc(struct vnode *, struct vattr *, struct ucred *);
|
||||
static vop_lookup_t nfs_lookup;
|
||||
static vop_create_t nfs_create;
|
||||
static vop_mknod_t nfs_mknod;
|
||||
@ -471,7 +469,7 @@ nfs_open(struct vop_open_args *ap)
|
||||
np->n_attrstamp = 0;
|
||||
if (vp->v_type == VDIR)
|
||||
np->n_direofoffset = 0;
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred);
|
||||
if (error)
|
||||
return (error);
|
||||
mtx_lock(&np->n_mtx);
|
||||
@ -487,7 +485,7 @@ nfs_open(struct vop_open_args *ap)
|
||||
np->n_attrstamp = 0;
|
||||
}
|
||||
mtx_unlock(&np->n_mtx);
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);
|
||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred);
|
||||
if (error)
|
||||
return (error);
|
||||
mtx_lock(&np->n_mtx);
|
||||
@ -589,7 +587,7 @@ nfs_close(struct vop_close_args *ap)
|
||||
* cannot clear it if we don't commit.
|
||||
*/
|
||||
int cm = nfsv3_commit_on_close ? 1 : 0;
|
||||
error = nfs_flush(vp, MNT_WAIT, ap->a_td, cm);
|
||||
error = nfs_flush(vp, MNT_WAIT, cm);
|
||||
/* np->n_flag &= ~NMODIFIED; */
|
||||
} else
|
||||
error = nfs_vinvalbuf(vp, V_SAVE, ap->a_td, 1);
|
||||
@ -632,6 +630,7 @@ nfs_getattr(struct vop_getattr_args *ap)
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct nfsnode *np = VTONFS(vp);
|
||||
struct thread *td = curthread;
|
||||
caddr_t bpos, dpos;
|
||||
int error = 0;
|
||||
struct mbuf *mreq, *mrep, *md, *mb;
|
||||
@ -651,7 +650,7 @@ nfs_getattr(struct vop_getattr_args *ap)
|
||||
goto nfsmout;
|
||||
if (v3 && nfsaccess_cache_timeout > 0) {
|
||||
nfsstats.accesscache_misses++;
|
||||
nfs3_access_otw(vp, NFSV3ACCESS_ALL, ap->a_td, ap->a_cred);
|
||||
nfs3_access_otw(vp, NFSV3ACCESS_ALL, td, ap->a_cred);
|
||||
if (nfs_getattrcache(vp, ap->a_vap) == 0)
|
||||
goto nfsmout;
|
||||
}
|
||||
@ -660,7 +659,7 @@ nfs_getattr(struct vop_getattr_args *ap)
|
||||
mb = mreq;
|
||||
bpos = mtod(mb, caddr_t);
|
||||
nfsm_fhtom(vp, v3);
|
||||
nfsm_request(vp, NFSPROC_GETATTR, ap->a_td, ap->a_cred);
|
||||
nfsm_request(vp, NFSPROC_GETATTR, td, ap->a_cred);
|
||||
if (!error) {
|
||||
nfsm_loadattr(vp, ap->a_vap);
|
||||
}
|
||||
@ -678,6 +677,7 @@ nfs_setattr(struct vop_setattr_args *ap)
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct nfsnode *np = VTONFS(vp);
|
||||
struct vattr *vap = ap->a_vap;
|
||||
struct thread *td = curthread;
|
||||
int error = 0;
|
||||
u_quad_t tsize;
|
||||
|
||||
@ -733,16 +733,16 @@ nfs_setattr(struct vop_setattr_args *ap)
|
||||
mtx_lock(&np->n_mtx);
|
||||
tsize = np->n_size;
|
||||
mtx_unlock(&np->n_mtx);
|
||||
error = nfs_meta_setsize(vp, ap->a_cred,
|
||||
ap->a_td, vap->va_size);
|
||||
error = nfs_meta_setsize(vp, ap->a_cred, td,
|
||||
vap->va_size);
|
||||
mtx_lock(&np->n_mtx);
|
||||
if (np->n_flag & NMODIFIED) {
|
||||
tsize = np->n_size;
|
||||
mtx_unlock(&np->n_mtx);
|
||||
if (vap->va_size == 0)
|
||||
error = nfs_vinvalbuf(vp, 0, ap->a_td, 1);
|
||||
error = nfs_vinvalbuf(vp, 0, td, 1);
|
||||
else
|
||||
error = nfs_vinvalbuf(vp, V_SAVE, ap->a_td, 1);
|
||||
error = nfs_vinvalbuf(vp, V_SAVE, td, 1);
|
||||
if (error) {
|
||||
vnode_pager_setsize(vp, tsize);
|
||||
goto out;
|
||||
@ -764,13 +764,13 @@ nfs_setattr(struct vop_setattr_args *ap)
|
||||
if ((vap->va_mtime.tv_sec != VNOVAL || vap->va_atime.tv_sec != VNOVAL) &&
|
||||
(np->n_flag & NMODIFIED) && vp->v_type == VREG) {
|
||||
mtx_unlock(&np->n_mtx);
|
||||
if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_td, 1)) != 0 &&
|
||||
if ((error = nfs_vinvalbuf(vp, V_SAVE, td, 1)) != 0 &&
|
||||
(error == EINTR || error == EIO))
|
||||
return error;
|
||||
} else
|
||||
mtx_unlock(&np->n_mtx);
|
||||
}
|
||||
error = nfs_setattrrpc(vp, vap, ap->a_cred, ap->a_td);
|
||||
error = nfs_setattrrpc(vp, vap, ap->a_cred);
|
||||
if (error && vap->va_size != VNOVAL) {
|
||||
mtx_lock(&np->n_mtx);
|
||||
np->n_size = np->n_vattr.va_size = tsize;
|
||||
@ -785,8 +785,7 @@ nfs_setattr(struct vop_setattr_args *ap)
|
||||
* Do an nfs setattr rpc.
|
||||
*/
|
||||
static int
|
||||
nfs_setattrrpc(struct vnode *vp, struct vattr *vap, struct ucred *cred,
|
||||
struct thread *td)
|
||||
nfs_setattrrpc(struct vnode *vp, struct vattr *vap, struct ucred *cred)
|
||||
{
|
||||
struct nfsv2_sattr *sp;
|
||||
struct nfsnode *np = VTONFS(vp);
|
||||
@ -823,7 +822,7 @@ nfs_setattrrpc(struct vnode *vp, struct vattr *vap, struct ucred *cred,
|
||||
txdr_nfsv2time(&vap->va_atime, &sp->sa_atime);
|
||||
txdr_nfsv2time(&vap->va_mtime, &sp->sa_mtime);
|
||||
}
|
||||
nfsm_request(vp, NFSPROC_SETATTR, td, cred);
|
||||
nfsm_request(vp, NFSPROC_SETATTR, curthread, cred);
|
||||
if (v3) {
|
||||
np->n_modestamp = 0;
|
||||
nfsm_wcc_data(vp, wccflag);
|
||||
@ -873,7 +872,7 @@ nfs_lookup(struct vop_lookup_args *ap)
|
||||
struct vattr vattr;
|
||||
|
||||
newvp = *vpp;
|
||||
if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, td)
|
||||
if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred)
|
||||
&& vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) {
|
||||
nfsstats.lookupcache_hits++;
|
||||
if (cnp->cn_nameiop != LOOKUP &&
|
||||
@ -1276,9 +1275,8 @@ nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
|
||||
else {
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread)) != 0) {
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)) != 0)
|
||||
return (error);
|
||||
}
|
||||
nfsstats.rpccnt[NFSPROC_MKNOD]++;
|
||||
mreq = nfsm_reqhead(dvp, NFSPROC_MKNOD, NFSX_FH(v3) + 4 * NFSX_UNSIGNED +
|
||||
+ nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3));
|
||||
@ -1375,9 +1373,8 @@ nfs_create(struct vop_create_args *ap)
|
||||
if (vap->va_type == VSOCK)
|
||||
return (nfs_mknodrpc(dvp, ap->a_vpp, cnp, vap));
|
||||
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread)) != 0) {
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)) != 0)
|
||||
return (error);
|
||||
}
|
||||
if (vap->va_vaflags & VA_EXCLUSIVE)
|
||||
fmode |= O_EXCL;
|
||||
again:
|
||||
@ -1451,7 +1448,7 @@ nfs_create(struct vop_create_args *ap)
|
||||
vfs_timestamp(&vap->va_mtime);
|
||||
if (vap->va_atime.tv_sec == VNOVAL)
|
||||
vap->va_atime = vap->va_mtime;
|
||||
error = nfs_setattrrpc(newvp, vap, cnp->cn_cred, cnp->cn_thread);
|
||||
error = nfs_setattrrpc(newvp, vap, cnp->cn_cred);
|
||||
if (error)
|
||||
vput(newvp);
|
||||
}
|
||||
@ -1498,8 +1495,7 @@ nfs_remove(struct vop_remove_args *ap)
|
||||
if (vp->v_type == VDIR)
|
||||
error = EPERM;
|
||||
else if (vrefcnt(vp) == 1 || (np->n_sillyrename &&
|
||||
VOP_GETATTR(vp, &vattr, cnp->cn_cred, cnp->cn_thread) == 0 &&
|
||||
vattr.va_nlink > 1)) {
|
||||
!VOP_GETATTR(vp, &vattr, cnp->cn_cred) && vattr.va_nlink > 1)) {
|
||||
/*
|
||||
* Purge the name cache so that the chance of a lookup for
|
||||
* the name succeeding while the remove is in progress is
|
||||
@ -1883,9 +1879,8 @@ nfs_mkdir(struct vop_mkdir_args *ap)
|
||||
struct vattr vattr;
|
||||
int v3 = NFS_ISV3(dvp);
|
||||
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread)) != 0) {
|
||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)) != 0)
|
||||
return (error);
|
||||
}
|
||||
len = cnp->cn_namelen;
|
||||
nfsstats.rpccnt[NFSPROC_MKDIR]++;
|
||||
mreq = nfsm_reqhead(dvp, NFSPROC_MKDIR,
|
||||
@ -1997,7 +1992,7 @@ nfs_readdir(struct vop_readdir_args *ap)
|
||||
*/
|
||||
if (np->n_direofoffset > 0 && uio->uio_offset >= np->n_direofoffset &&
|
||||
(np->n_flag & NMODIFIED) == 0) {
|
||||
if (VOP_GETATTR(vp, &vattr, ap->a_cred, uio->uio_td) == 0) {
|
||||
if (VOP_GETATTR(vp, &vattr, ap->a_cred) == 0) {
|
||||
mtx_lock(&np->n_mtx);
|
||||
if (!NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime)) {
|
||||
mtx_unlock(&np->n_mtx);
|
||||
@ -2724,7 +2719,8 @@ nfs_strategy(struct vop_strategy_args *ap)
|
||||
static int
|
||||
nfs_fsync(struct vop_fsync_args *ap)
|
||||
{
|
||||
return (nfs_flush(ap->a_vp, ap->a_waitfor, ap->a_td, 1));
|
||||
|
||||
return (nfs_flush(ap->a_vp, ap->a_waitfor, 1));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2733,8 +2729,7 @@ nfs_fsync(struct vop_fsync_args *ap)
|
||||
* associated with the vnode.
|
||||
*/
|
||||
static int
|
||||
nfs_flush(struct vnode *vp, int waitfor, struct thread *td,
|
||||
int commit)
|
||||
nfs_flush(struct vnode *vp, int waitfor, int commit)
|
||||
{
|
||||
struct nfsnode *np = VTONFS(vp);
|
||||
struct buf *bp;
|
||||
@ -2747,6 +2742,7 @@ nfs_flush(struct vnode *vp, int waitfor, struct thread *td,
|
||||
struct ucred* wcred = NULL;
|
||||
struct buf **bvec = NULL;
|
||||
struct bufobj *bo;
|
||||
struct thread *td = curthread;
|
||||
#ifndef NFS_COMMITBVECSIZ
|
||||
#define NFS_COMMITBVECSIZ 20
|
||||
#endif
|
||||
@ -3198,7 +3194,7 @@ nfsspec_access(struct vop_access_args *ap)
|
||||
}
|
||||
}
|
||||
vap = &vattr;
|
||||
error = VOP_GETATTR(vp, vap, cred, ap->a_td);
|
||||
error = VOP_GETATTR(vp, vap, cred);
|
||||
if (error)
|
||||
goto out;
|
||||
error = vaccess(vp->v_type, vap->va_mode, vap->va_uid, vap->va_gid,
|
||||
@ -3274,7 +3270,7 @@ nfsfifo_close(struct vop_close_args *ap)
|
||||
if (np->n_flag & NUPD)
|
||||
vattr.va_mtime = np->n_mtim;
|
||||
mtx_unlock(&np->n_mtx);
|
||||
(void)VOP_SETATTR(vp, &vattr, ap->a_cred, ap->a_td);
|
||||
(void)VOP_SETATTR(vp, &vattr, ap->a_cred);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ nfsrv3_access(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
if ((nfsmode & testmode) &&
|
||||
nfsrv_access(vp, VEXEC, cred, rdonly, td, 0))
|
||||
nfsmode &= ~testmode;
|
||||
getret = VOP_GETATTR(vp, vap, cred, td);
|
||||
getret = VOP_GETATTR(vp, vap, cred);
|
||||
vput(vp);
|
||||
vp = NULL;
|
||||
nfsm_reply(NFSX_POSTOPATTR(1) + NFSX_UNSIGNED);
|
||||
@ -288,7 +288,7 @@ nfsrv_getattr(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
error = 0;
|
||||
goto nfsmout;
|
||||
}
|
||||
error = VOP_GETATTR(vp, vap, cred, td);
|
||||
error = VOP_GETATTR(vp, vap, cred);
|
||||
vput(vp);
|
||||
vp = NULL;
|
||||
nfsm_reply(NFSX_FATTR(nfsd->nd_flag & ND_NFSV3));
|
||||
@ -405,7 +405,7 @@ nfsrv_setattr(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
* vp now an active resource, pay careful attention to cleanup
|
||||
*/
|
||||
if (v3) {
|
||||
error = preat_ret = VOP_GETATTR(vp, &preat, cred, td);
|
||||
error = preat_ret = VOP_GETATTR(vp, &preat, cred);
|
||||
if (!error && gcheck &&
|
||||
(preat.va_ctime.tv_sec != guard.tv_sec ||
|
||||
preat.va_ctime.tv_nsec != guard.tv_nsec))
|
||||
@ -438,8 +438,8 @@ nfsrv_setattr(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
td, 0)) != 0)
|
||||
goto out;
|
||||
}
|
||||
error = VOP_SETATTR(vp, vap, cred, td);
|
||||
postat_ret = VOP_GETATTR(vp, vap, cred, td);
|
||||
error = VOP_SETATTR(vp, vap, cred);
|
||||
postat_ret = VOP_GETATTR(vp, vap, cred);
|
||||
if (!error)
|
||||
error = postat_ret;
|
||||
out:
|
||||
@ -612,7 +612,7 @@ nfsrv_lookup(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
error = VOP_VPTOFH(vp, &fhp->fh_fid);
|
||||
if (!error)
|
||||
error = VOP_GETATTR(vp, vap, cred, td);
|
||||
error = VOP_GETATTR(vp, vap, cred);
|
||||
|
||||
vput(vp);
|
||||
vrele(ndp->ni_startdir);
|
||||
@ -729,7 +729,7 @@ nfsrv_readlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
error = ENXIO;
|
||||
} else
|
||||
error = VOP_READLINK(vp, uiop, cred);
|
||||
getret = VOP_GETATTR(vp, &attr, cred, td);
|
||||
getret = VOP_GETATTR(vp, &attr, cred);
|
||||
vput(vp);
|
||||
vp = NULL;
|
||||
nfsm_reply(NFSX_POSTOPATTR(v3) + NFSX_UNSIGNED);
|
||||
@ -832,7 +832,7 @@ nfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
error = nfsrv_access(vp, VEXEC, cred,
|
||||
rdonly, td, 1);
|
||||
}
|
||||
getret = VOP_GETATTR(vp, vap, cred, td);
|
||||
getret = VOP_GETATTR(vp, vap, cred);
|
||||
if (!error)
|
||||
error = getret;
|
||||
if (error) {
|
||||
@ -972,7 +972,7 @@ nfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
off = uiop->uio_offset;
|
||||
nh->nh_nextr = off;
|
||||
FREE((caddr_t)iv2, M_TEMP);
|
||||
if (error || (getret = VOP_GETATTR(vp, vap, cred, td))) {
|
||||
if (error || (getret = VOP_GETATTR(vp, vap, cred))) {
|
||||
if (!error)
|
||||
error = getret;
|
||||
m_freem(mreq);
|
||||
@ -1124,7 +1124,7 @@ nfsrv_write(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
goto nfsmout;
|
||||
}
|
||||
if (v3)
|
||||
forat_ret = VOP_GETATTR(vp, &forat, cred, td);
|
||||
forat_ret = VOP_GETATTR(vp, &forat, cred);
|
||||
if (vp->v_type != VREG) {
|
||||
if (v3)
|
||||
error = EINVAL;
|
||||
@ -1181,7 +1181,7 @@ nfsrv_write(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
nfsrvstats.srvvop_writes++;
|
||||
FREE((caddr_t)iv, M_TEMP);
|
||||
}
|
||||
aftat_ret = VOP_GETATTR(vp, vap, cred, td);
|
||||
aftat_ret = VOP_GETATTR(vp, vap, cred);
|
||||
vput(vp);
|
||||
vp = NULL;
|
||||
if (!error)
|
||||
@ -1436,7 +1436,7 @@ nfsrv_writegather(struct nfsrv_descript **ndp, struct nfssvc_sock *slp,
|
||||
slp, nfsd->nd_nam, &rdonly, TRUE);
|
||||
if (!error) {
|
||||
if (v3)
|
||||
forat_ret = VOP_GETATTR(vp, &forat, cred, td);
|
||||
forat_ret = VOP_GETATTR(vp, &forat, cred);
|
||||
if (vp->v_type != VREG) {
|
||||
if (v3)
|
||||
error = EINVAL;
|
||||
@ -1501,7 +1501,7 @@ nfsrv_writegather(struct nfsrv_descript **ndp, struct nfssvc_sock *slp,
|
||||
}
|
||||
m_freem(mrep);
|
||||
if (vp) {
|
||||
aftat_ret = VOP_GETATTR(vp, &va, cred, td);
|
||||
aftat_ret = VOP_GETATTR(vp, &va, cred);
|
||||
vput(vp);
|
||||
vp = NULL;
|
||||
}
|
||||
@ -1790,8 +1790,8 @@ nfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
VATTR_NULL(vap);
|
||||
bcopy(cverf, (caddr_t)&vap->va_atime,
|
||||
NFSX_V3CREATEVERF);
|
||||
error = VOP_SETATTR(nd.ni_vp, vap, cred,
|
||||
td);
|
||||
error = VOP_SETATTR(nd.ni_vp, vap,
|
||||
cred);
|
||||
}
|
||||
}
|
||||
} else if (vap->va_type == VCHR || vap->va_type == VBLK ||
|
||||
@ -1858,8 +1858,7 @@ nfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
tempsize = vap->va_size;
|
||||
VATTR_NULL(vap);
|
||||
vap->va_size = tempsize;
|
||||
error = VOP_SETATTR(nd.ni_vp, vap, cred,
|
||||
td);
|
||||
error = VOP_SETATTR(nd.ni_vp, vap, cred);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1869,14 +1868,14 @@ nfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
fhp->fh_fsid = nd.ni_vp->v_mount->mnt_stat.f_fsid;
|
||||
error = VOP_VPTOFH(nd.ni_vp, &fhp->fh_fid);
|
||||
if (!error)
|
||||
error = VOP_GETATTR(nd.ni_vp, vap, cred, td);
|
||||
error = VOP_GETATTR(nd.ni_vp, vap, cred);
|
||||
}
|
||||
if (v3) {
|
||||
if (exclusive_flag && !error &&
|
||||
bcmp(cverf, (caddr_t)&vap->va_atime, NFSX_V3CREATEVERF))
|
||||
error = EEXIST;
|
||||
if (dirp == nd.ni_dvp)
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
|
||||
else {
|
||||
/* Drop the other locks to avoid deadlock. */
|
||||
if (nd.ni_dvp) {
|
||||
@ -1891,7 +1890,7 @@ nfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
nd.ni_vp = NULL;
|
||||
|
||||
vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
|
||||
VOP_UNLOCK(dirp, 0);
|
||||
}
|
||||
}
|
||||
@ -2072,7 +2071,7 @@ nfsrv_mknod(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
error = VOP_VPTOFH(vp, &fhp->fh_fid);
|
||||
if (!error)
|
||||
error = VOP_GETATTR(vp, vap, cred, td);
|
||||
error = VOP_GETATTR(vp, vap, cred);
|
||||
}
|
||||
if (nd.ni_dvp) {
|
||||
if (nd.ni_dvp == nd.ni_vp)
|
||||
@ -2093,7 +2092,7 @@ nfsrv_mknod(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
if (dirp) {
|
||||
vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
|
||||
VOP_UNLOCK(dirp, 0);
|
||||
}
|
||||
ereply:
|
||||
@ -2195,7 +2194,7 @@ nfsrv_remove(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
}
|
||||
if (dirp && v3) {
|
||||
if (dirp == nd.ni_dvp)
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
|
||||
else {
|
||||
/* Drop the other locks to avoid deadlock. */
|
||||
if (nd.ni_dvp) {
|
||||
@ -2210,7 +2209,7 @@ nfsrv_remove(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
nd.ni_vp = NULL;
|
||||
|
||||
vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
|
||||
VOP_UNLOCK(dirp, 0);
|
||||
}
|
||||
vrele(dirp);
|
||||
@ -2421,12 +2420,12 @@ nfsrv_rename(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
|
||||
if (fdirp) {
|
||||
vn_lock(fdirp, LK_EXCLUSIVE | LK_RETRY);
|
||||
fdiraft_ret = VOP_GETATTR(fdirp, &fdiraft, cred, td);
|
||||
fdiraft_ret = VOP_GETATTR(fdirp, &fdiraft, cred);
|
||||
VOP_UNLOCK(fdirp, 0);
|
||||
}
|
||||
if (tdirp) {
|
||||
vn_lock(tdirp, LK_EXCLUSIVE | LK_RETRY);
|
||||
tdiraft_ret = VOP_GETATTR(tdirp, &tdiraft, cred, td);
|
||||
tdiraft_ret = VOP_GETATTR(tdirp, &tdiraft, cred);
|
||||
VOP_UNLOCK(tdirp, 0);
|
||||
}
|
||||
nfsm_srvwcc_data(fdirfor_ret, &fdirfor, fdiraft_ret, &fdiraft);
|
||||
@ -2525,7 +2524,7 @@ nfsrv_link(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
goto nfsmout;
|
||||
}
|
||||
if (v3)
|
||||
getret = VOP_GETATTR(vp, &at, cred, td);
|
||||
getret = VOP_GETATTR(vp, &at, cred);
|
||||
if (vp->v_type == VDIR) {
|
||||
error = EPERM; /* POSIX */
|
||||
goto out1;
|
||||
@ -2567,11 +2566,11 @@ nfsrv_link(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
|
||||
out1:
|
||||
if (v3)
|
||||
getret = VOP_GETATTR(vp, &at, cred, td);
|
||||
getret = VOP_GETATTR(vp, &at, cred);
|
||||
out2:
|
||||
if (dirp) {
|
||||
if (dirp == nd.ni_dvp)
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
|
||||
else {
|
||||
/* Release existing locks to prevent deadlock. */
|
||||
if (nd.ni_dvp) {
|
||||
@ -2586,7 +2585,7 @@ nfsrv_link(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
nd.ni_vp = NULL;
|
||||
|
||||
vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
|
||||
VOP_UNLOCK(dirp, 0);
|
||||
}
|
||||
}
|
||||
@ -2744,8 +2743,7 @@ nfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
fhp->fh_fsid = nd.ni_vp->v_mount->mnt_stat.f_fsid;
|
||||
error = VOP_VPTOFH(nd.ni_vp, &fhp->fh_fid);
|
||||
if (!error)
|
||||
error = VOP_GETATTR(nd.ni_vp, vap, cred,
|
||||
td);
|
||||
error = VOP_GETATTR(nd.ni_vp, vap, cred);
|
||||
vput(nd.ni_vp);
|
||||
nd.ni_vp = NULL;
|
||||
}
|
||||
@ -2762,7 +2760,7 @@ nfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
}
|
||||
if (dirp) {
|
||||
vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
|
||||
VOP_UNLOCK(dirp, 0);
|
||||
}
|
||||
if (nd.ni_startdir) {
|
||||
@ -2900,12 +2898,12 @@ nfsrv_mkdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
fhp->fh_fsid = nd.ni_vp->v_mount->mnt_stat.f_fsid;
|
||||
error = VOP_VPTOFH(nd.ni_vp, &fhp->fh_fid);
|
||||
if (!error)
|
||||
error = VOP_GETATTR(nd.ni_vp, vap, cred, td);
|
||||
error = VOP_GETATTR(nd.ni_vp, vap, cred);
|
||||
}
|
||||
out:
|
||||
if (dirp) {
|
||||
if (dirp == nd.ni_dvp) {
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
|
||||
} else {
|
||||
/* Release existing locks to prevent deadlock. */
|
||||
if (nd.ni_dvp) {
|
||||
@ -2924,7 +2922,7 @@ nfsrv_mkdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
nd.ni_dvp = NULL;
|
||||
nd.ni_vp = NULL;
|
||||
vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
|
||||
VOP_UNLOCK(dirp, 0);
|
||||
}
|
||||
}
|
||||
@ -3047,7 +3045,7 @@ nfsrv_rmdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
|
||||
if (dirp) {
|
||||
if (dirp == nd.ni_dvp)
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
|
||||
else {
|
||||
/* Release existing locks to prevent deadlock. */
|
||||
if (nd.ni_dvp) {
|
||||
@ -3061,7 +3059,7 @@ nfsrv_rmdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
nd.ni_dvp = NULL;
|
||||
nd.ni_vp = NULL;
|
||||
vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
|
||||
diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
|
||||
VOP_UNLOCK(dirp, 0);
|
||||
}
|
||||
}
|
||||
@ -3199,7 +3197,7 @@ nfsrv_readdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
* Obtain lock on vnode for this section of the code
|
||||
*/
|
||||
if (v3) {
|
||||
error = getret = VOP_GETATTR(vp, &at, cred, td);
|
||||
error = getret = VOP_GETATTR(vp, &at, cred);
|
||||
#if 0
|
||||
/*
|
||||
* XXX This check may be too strict for Solaris 2.5 clients.
|
||||
@ -3246,7 +3244,7 @@ nfsrv_readdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
if (!cookies && !error)
|
||||
error = NFSERR_PERM;
|
||||
if (v3) {
|
||||
getret = VOP_GETATTR(vp, &at, cred, td);
|
||||
getret = VOP_GETATTR(vp, &at, cred);
|
||||
if (!error)
|
||||
error = getret;
|
||||
}
|
||||
@ -3487,7 +3485,7 @@ nfsrv_readdirplus(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
error = 0;
|
||||
goto nfsmout;
|
||||
}
|
||||
error = getret = VOP_GETATTR(vp, &at, cred, td);
|
||||
error = getret = VOP_GETATTR(vp, &at, cred);
|
||||
#if 0
|
||||
/*
|
||||
* XXX This check may be too strict for Solaris 2.5 clients.
|
||||
@ -3525,7 +3523,7 @@ nfsrv_readdirplus(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
}
|
||||
error = VOP_READDIR(vp, &io, cred, &eofflag, &ncookies, &cookies);
|
||||
off = (u_quad_t)io.uio_offset;
|
||||
getret = VOP_GETATTR(vp, &at, cred, td);
|
||||
getret = VOP_GETATTR(vp, &at, cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
if (!cookies && !error)
|
||||
error = NFSERR_PERM;
|
||||
@ -3653,7 +3651,7 @@ nfsrv_readdirplus(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
nvp = NULL;
|
||||
goto invalid;
|
||||
}
|
||||
if (VOP_GETATTR(nvp, vap, cred, td)) {
|
||||
if (VOP_GETATTR(nvp, vap, cred)) {
|
||||
vput(nvp);
|
||||
nvp = NULL;
|
||||
goto invalid;
|
||||
@ -3824,7 +3822,7 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
error = 0;
|
||||
goto nfsmout;
|
||||
}
|
||||
for_ret = VOP_GETATTR(vp, &bfor, cred, td);
|
||||
for_ret = VOP_GETATTR(vp, &bfor, cred);
|
||||
|
||||
if (cnt > MAX_COMMIT_COUNT) {
|
||||
/*
|
||||
@ -3908,7 +3906,7 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
BO_UNLOCK(bo);
|
||||
}
|
||||
|
||||
aft_ret = VOP_GETATTR(vp, &aft, cred, td);
|
||||
aft_ret = VOP_GETATTR(vp, &aft, cred);
|
||||
vput(vp);
|
||||
vp = NULL;
|
||||
ereply:
|
||||
@ -3971,7 +3969,7 @@ nfsrv_statfs(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
}
|
||||
sf = &statfs;
|
||||
error = VFS_STATFS(vp->v_mount, sf, td);
|
||||
getret = VOP_GETATTR(vp, &at, cred, td);
|
||||
getret = VOP_GETATTR(vp, &at, cred);
|
||||
vput(vp);
|
||||
vp = NULL;
|
||||
nfsm_reply(NFSX_POSTOPATTR(v3) + NFSX_STATFS(v3));
|
||||
@ -4068,7 +4066,7 @@ nfsrv_fsinfo(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
VFS_STATFS(vp->v_mount, &sb, td);
|
||||
maxfsize = (u_quad_t)0x80000000 * sb.f_bsize - 1;
|
||||
|
||||
getret = VOP_GETATTR(vp, &at, cred, td);
|
||||
getret = VOP_GETATTR(vp, &at, cred);
|
||||
vput(vp);
|
||||
vp = NULL;
|
||||
nfsm_reply(NFSX_V3POSTOPATTR + NFSX_V3FSINFO);
|
||||
@ -4148,7 +4146,7 @@ nfsrv_pathconf(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
error = VOP_PATHCONF(vp, _PC_CHOWN_RESTRICTED, &chownres);
|
||||
if (!error)
|
||||
error = VOP_PATHCONF(vp, _PC_NO_TRUNC, ¬runc);
|
||||
getret = VOP_GETATTR(vp, &at, cred, td);
|
||||
getret = VOP_GETATTR(vp, &at, cred);
|
||||
vput(vp);
|
||||
vp = NULL;
|
||||
nfsm_reply(NFSX_V3POSTOPATTR + NFSX_V3PATHCONF);
|
||||
@ -4272,7 +4270,7 @@ nfsrv_access(struct vnode *vp, int flags, struct ucred *cred,
|
||||
return (ETXTBSY);
|
||||
}
|
||||
|
||||
error = VOP_GETATTR(vp, &vattr, cred, td);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
if (error)
|
||||
return (error);
|
||||
error = VOP_ACCESS(vp, flags, cred, td);
|
||||
|
@ -688,7 +688,7 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len,
|
||||
if (v3) {
|
||||
vn_lock(dp, LK_EXCLUSIVE | LK_RETRY);
|
||||
*retdirattr_retp = VOP_GETATTR(dp, retdirattrp,
|
||||
ndp->ni_cnd.cn_cred, td);
|
||||
ndp->ni_cnd.cn_cred);
|
||||
VOP_UNLOCK(dp, 0);
|
||||
}
|
||||
|
||||
|
@ -762,7 +762,7 @@ audit_arg_vnode(struct vnode *vp, u_int64_t flags)
|
||||
vnp = &ar->k_ar.ar_arg_vnode2;
|
||||
}
|
||||
|
||||
error = VOP_GETATTR(vp, &vattr, curthread->td_ucred, curthread);
|
||||
error = VOP_GETATTR(vp, &vattr, curthread->td_ucred);
|
||||
if (error) {
|
||||
/* XXX: How to handle this case? */
|
||||
return;
|
||||
|
@ -128,7 +128,7 @@ audit_record_write(struct vnode *vp, struct ucred *cred, void *data,
|
||||
if (error)
|
||||
goto fail;
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, cred, curthread);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
if (error)
|
||||
goto fail;
|
||||
|
@ -436,7 +436,7 @@ ugidfw_check_vp(struct ucred *cred, struct vnode *vp, int acc_mode)
|
||||
|
||||
if (!ugidfw_enabled)
|
||||
return (0);
|
||||
error = VOP_GETATTR(vp, &vap, cred, curthread);
|
||||
error = VOP_GETATTR(vp, &vap, cred);
|
||||
if (error)
|
||||
return (error);
|
||||
return (ugidfw_check(cred, vp, &vap, acc_mode));
|
||||
|
@ -563,8 +563,7 @@ maybe_demote(struct mac_lomac *subjlabel, struct mac_lomac *objlabel,
|
||||
objlabeltext = sbuf_data(&objlabel_sb);
|
||||
|
||||
pgid = p->p_pgrp->pg_id; /* XXX could be stale? */
|
||||
if (vp != NULL && VOP_GETATTR(vp, &va, curthread->td_ucred,
|
||||
curthread) == 0) {
|
||||
if (vp != NULL && VOP_GETATTR(vp, &va, curthread->td_ucred) == 0) {
|
||||
log(LOG_INFO, "LOMAC: level-%s subject p%dg%du%d:%s demoted to"
|
||||
" level %s after %s a level-%s %s (inode=%ld, "
|
||||
"mountpount=%s)\n",
|
||||
|
@ -693,8 +693,7 @@ void vop_unlock_pre(void *a);
|
||||
\
|
||||
osize = ooffset = noffset = 0; \
|
||||
if (!VN_KNLIST_EMPTY((ap)->a_vp)) { \
|
||||
error = VOP_GETATTR((ap)->a_vp, &va, (ap)->a_cred, \
|
||||
curthread); \
|
||||
error = VOP_GETATTR((ap)->a_vp, &va, (ap)->a_cred); \
|
||||
if (error) \
|
||||
return (error); \
|
||||
ooffset = (ap)->a_uio->uio_offset; \
|
||||
@ -740,7 +739,7 @@ void vfs_hash_rehash(struct vnode *vp, u_int hash);
|
||||
void vfs_hash_remove(struct vnode *vp);
|
||||
|
||||
int vfs_kqfilter(struct vop_kqfilter_args *);
|
||||
void vfs_mark_atime(struct vnode *vp, struct thread *td);
|
||||
void vfs_mark_atime(struct vnode *vp, struct ucred *cred);
|
||||
struct dirent;
|
||||
int vfs_read_dirent(struct vop_readdir_args *ap, struct dirent *dp, off_t off);
|
||||
|
||||
|
@ -557,7 +557,7 @@ ffs_snapshot(mp, snapfile)
|
||||
VI_UNLOCK(xvp);
|
||||
if (snapdebug)
|
||||
vprint("ffs_snapshot: busy vnode", xvp);
|
||||
if (VOP_GETATTR(xvp, &vat, td->td_ucred, td) == 0 &&
|
||||
if (VOP_GETATTR(xvp, &vat, td->td_ucred) == 0 &&
|
||||
vat.va_nlink > 0) {
|
||||
VOP_UNLOCK(xvp, 0);
|
||||
vdrop(xvp);
|
||||
|
@ -402,7 +402,6 @@ ufs_getattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
@ -466,14 +465,13 @@ ufs_setattr(ap)
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct thread *a_td;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vattr *vap = ap->a_vap;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct inode *ip = VTOI(vp);
|
||||
struct ucred *cred = ap->a_cred;
|
||||
struct thread *td = ap->a_td;
|
||||
struct thread *td = curthread;
|
||||
int error;
|
||||
|
||||
/*
|
||||
|
@ -1965,7 +1965,7 @@ swapon(struct thread *td, struct swapon_args *uap)
|
||||
error = swapongeom(td, vp);
|
||||
} else if (vp->v_type == VREG &&
|
||||
(vp->v_mount->mnt_vfc->vfc_flags & VFCF_NETWORK) != 0 &&
|
||||
(error = VOP_GETATTR(vp, &attr, td->td_ucred, td)) == 0) {
|
||||
(error = VOP_GETATTR(vp, &attr, td->td_ucred)) == 0) {
|
||||
/*
|
||||
* Allow direct swapping to NFS regular files in the same
|
||||
* way that nfs_mountroot() sets up diskless swapping.
|
||||
|
@ -1155,10 +1155,12 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize,
|
||||
vm_object_t obj;
|
||||
struct mount *mp;
|
||||
struct cdevsw *dsw;
|
||||
struct ucred *cred;
|
||||
int error, flags, type;
|
||||
int vfslocked;
|
||||
|
||||
mp = vp->v_mount;
|
||||
cred = td->td_ucred;
|
||||
vfslocked = VFS_LOCK_GIANT(mp);
|
||||
if ((error = vget(vp, LK_EXCLUSIVE, td)) != 0) {
|
||||
VFS_UNLOCK_GIANT(vfslocked);
|
||||
@ -1218,11 +1220,10 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize,
|
||||
error = EINVAL;
|
||||
goto done;
|
||||
}
|
||||
if ((error = VOP_GETATTR(vp, &va, td->td_ucred, td))) {
|
||||
if ((error = VOP_GETATTR(vp, &va, cred)))
|
||||
goto done;
|
||||
}
|
||||
#ifdef MAC
|
||||
error = mac_vnode_check_mmap(td->td_ucred, vp, prot, flags);
|
||||
error = mac_vnode_check_mmap(cred, vp, prot, flags);
|
||||
if (error != 0)
|
||||
goto done;
|
||||
#endif
|
||||
@ -1252,7 +1253,7 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize,
|
||||
}
|
||||
*objp = obj;
|
||||
*flagsp = flags;
|
||||
vfs_mark_atime(vp, td);
|
||||
vfs_mark_atime(vp, cred);
|
||||
|
||||
done:
|
||||
vput(vp);
|
||||
|
@ -122,7 +122,7 @@ vnode_create_vobject(struct vnode *vp, off_t isize, struct thread *td)
|
||||
if (vn_isdisk(vp, NULL)) {
|
||||
size = IDX_TO_OFF(INT_MAX);
|
||||
} else {
|
||||
if (VOP_GETATTR(vp, &va, td->td_ucred, td) != 0)
|
||||
if (VOP_GETATTR(vp, &va, td->td_ucred))
|
||||
return (0);
|
||||
size = va.va_size;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user