aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/vfs_syscalls.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 40dd8c069bfb..3db34c3689de 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -331,15 +331,13 @@ kern_statfs(struct thread *td, const char *path, enum uio_seg pathseg,
struct nameidata nd;
int error;
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1,
- pathseg, path, td);
+ NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, td);
error = namei(&nd);
if (error != 0)
return (error);
- mp = nd.ni_vp->v_mount;
- vfs_ref(mp);
+ mp = vfs_ref_from_vp(nd.ni_vp);
NDFREE_NOTHING(&nd);
- vput(nd.ni_vp);
+ vrele(nd.ni_vp);
return (kern_do_statfs(td, mp, buf));
}
@@ -379,14 +377,14 @@ kern_fstatfs(struct thread *td, int fd, struct statfs *buf)
if (error != 0)
return (error);
vp = fp->f_vnode;
- vn_lock(vp, LK_SHARED | LK_RETRY);
#ifdef AUDIT
- AUDIT_ARG_VNODE1(vp);
+ if (AUDITING_TD(td)) {
+ vn_lock(vp, LK_SHARED | LK_RETRY);
+ AUDIT_ARG_VNODE1(vp);
+ VOP_UNLOCK(vp);
+ }
#endif
- mp = vp->v_mount;
- if (mp != NULL)
- vfs_ref(mp);
- VOP_UNLOCK(vp);
+ mp = vfs_ref_from_vp(vp);
fdrop(fp, td);
return (kern_do_statfs(td, mp, buf));
}