aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_vnops.c
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2015-06-10 10:48:12 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2015-06-10 10:48:12 +0000
commitf6f6d24062224a443ecd5e3945cf25127ee819fe (patch)
treedbbb077ee034cbfe839c1ba19dbe5ce374a5c6a3 /sys/kern/vfs_vnops.c
parent4ea6a9a28fd7ae3cc6e8697bc93f9ce5ea6b6262 (diff)
downloadsrc-f6f6d24062224a443ecd5e3945cf25127ee819fe.tar.gz
src-f6f6d24062224a443ecd5e3945cf25127ee819fe.zip
Implement lockless resource limits.
Use the same scheme implemented to manage credentials. Code needing to look at process's credentials (as opposed to thred's) is provided with *_proc variants of relevant functions. Places which possibly had to take the proc lock anyway still use the proc pointer to access limits.
Notes
Notes: svn path=/head/; revision=284215
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r--sys/kern/vfs_vnops.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 573d00941988..0b073b9cf110 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -2106,19 +2106,18 @@ vn_vget_ino_gen(struct vnode *vp, vn_get_ino_t alloc, void *alloc_arg,
int
vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio,
- const struct thread *td)
+ struct thread *td)
{
if (vp->v_type != VREG || td == NULL)
return (0);
- PROC_LOCK(td->td_proc);
if ((uoff_t)uio->uio_offset + uio->uio_resid >
- lim_cur(td->td_proc, RLIMIT_FSIZE)) {
+ lim_cur(td, RLIMIT_FSIZE)) {
+ PROC_LOCK(td->td_proc);
kern_psignal(td->td_proc, SIGXFSZ);
PROC_UNLOCK(td->td_proc);
return (EFBIG);
}
- PROC_UNLOCK(td->td_proc);
return (0);
}