diff options
author | anton <anton@cvs.openbsd.org> | 2019-08-05 08:36:00 +0000 |
---|---|---|
committer | anton <anton@cvs.openbsd.org> | 2019-08-05 08:36:00 +0000 |
commit | 2de89e15b7def75453779ec4caaa525c42d8f6d5 (patch) | |
tree | 51666813036b139145bd44ffc7e017740fd196ae /sys/kern/kern_sysctl.c | |
parent | 2e6a89f0541effeff8b1f6b09613577db20cbc5d (diff) |
Allow concurrent reads of the f_offset field of struct file by
serializing both read/write operations using the existing file mutex.
The vnode lock still grants exclusive write access to the offset; the
mutex is only used to make the actual write atomic and prevent any
concurrent reader from observing intermediate values.
ok mpi@ visa@
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r-- | sys/kern/kern_sysctl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index f3bef1a20c0..73825840448 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.364 2019/07/16 17:39:02 bluhm Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.365 2019/08/05 08:35:59 anton Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -1102,8 +1102,8 @@ fill_file(struct kinfo_file *kf, struct file *fp, struct filedesc *fdp, kf->f_usecount = 0; if (suser(p) == 0 || p->p_ucred->cr_uid == fp->f_cred->cr_uid) { - kf->f_offset = fp->f_offset; mtx_enter(&fp->f_mtx); + kf->f_offset = fp->f_offset; kf->f_rxfer = fp->f_rxfer; kf->f_rwfer = fp->f_wxfer; kf->f_seek = fp->f_seek; |