diff options
author | 2019-07-10 16:43:19 +0000 | |
---|---|---|
committer | 2019-07-10 16:43:19 +0000 | |
commit | d038d3d54479d9074f1893898e90fbc1a73f75b9 (patch) | |
tree | 7ed38be055b73f7ee6939b5a40f57aee802e0fe3 /sys/dev/pci/drm/drm_linux.c | |
parent | Stop sleeping at PUSER. (diff) | |
download | wireguard-openbsd-d038d3d54479d9074f1893898e90fbc1a73f75b9.tar.xz wireguard-openbsd-d038d3d54479d9074f1893898e90fbc1a73f75b9.zip |
Make read/write of the f_offset field belonging to struct file MP-safe;
as part of the effort to unlock the kernel. Instead of relying on the
vnode lock, introduce a dedicated lock per file. Exclusive write access
is granted using the new foffset_enter and foffset_leave API. A
convenience function foffset_get is also available for threads that only
need to read the current offset.
The lock acquisition order in vn_write has been changed to match the one
in vn_read in order to avoid a potential deadlock. This change also gets
rid of a documented race in vn_read().
Inspired by the FreeBSD implementation.
With help and ok mpi@ visa@
Diffstat (limited to 'sys/dev/pci/drm/drm_linux.c')
-rw-r--r-- | sys/dev/pci/drm/drm_linux.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c index e338d37390c..90dc896ad3e 100644 --- a/sys/dev/pci/drm/drm_linux.c +++ b/sys/dev/pci/drm/drm_linux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.c,v 1.42 2019/07/10 07:56:30 kettenis Exp $ */ +/* $OpenBSD: drm_linux.c,v 1.43 2019/07/10 16:43:19 anton Exp $ */ /* * Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org> * Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org> @@ -1346,7 +1346,9 @@ dmabuf_seek(struct file *fp, off_t *offset, int whence, struct proc *p) default: return (EINVAL); } - fp->f_offset = *offset = newoff; + foffset_enter(fp); + foffset_leave(fp, newoff, 0); + *offset = newoff; return (0); } |