diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2019-06-21 09:39:50 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2019-06-21 09:39:50 +0000 |
commit | f36079e076349e28aa988c7155e5d5dca320d8f7 (patch) | |
tree | 75b2a8f1fb017c3e8bf90644b9085cabd9ec0a65 /sys/kern/vfs_vnops.c | |
parent | 841259cd98c59028504e22d3e387f0ba49ec95a8 (diff) |
Make resource limit access MP-safe. So far, the copy-on-write sharing
of resource limit structs has been done between processes. By applying
copy-on-write also between threads, threads can read rlimits in
a nearly lock-free manner.
Inspired by code in DragonFly BSD and FreeBSD.
OK mpi@, agreement from jmatthew@ and anton@
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r-- | sys/kern/vfs_vnops.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 2d5d00e5eff..c02f8f0cba1 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.97 2018/08/20 16:00:22 mpi Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.98 2019/06/21 09:39:48 visa Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -247,7 +247,7 @@ vn_fsizechk(struct vnode *vp, struct uio *uio, int ioflag, ssize_t *overrun) *overrun = 0; if (vp->v_type == VREG && p != NULL && !(ioflag & IO_NOLIMIT)) { - rlim_t limit = p->p_rlimit[RLIMIT_FSIZE].rlim_cur; + rlim_t limit = lim_cur_proc(p, RLIMIT_FSIZE); /* if already at or over the limit, send the signal and fail */ if (uio->uio_offset >= limit) { |