diff options
author | anton <anton@cvs.openbsd.org> | 2021-05-06 12:55:21 +0000 |
---|---|---|
committer | anton <anton@cvs.openbsd.org> | 2021-05-06 12:55:21 +0000 |
commit | 8ee56fce2d74d17f4a5b4379ed4b81c49da8137e (patch) | |
tree | 506304732d132c57e5e10a19920b9cab58d945c1 /sys/kern | |
parent | a738c902f8540b3705fc316c3034ea64012615c4 (diff) |
Unlock lseek(2).
In August 2019 I tried to unlock lseek which failed since the vnode lock
could not be acquired without holding the kernel lock back then.
claudio@ recently made it possible to acquire a vnode lock without
holding the kernel lock. The kernel lock is still required around
VOP_GETATTR() as the underlying file system implementations are not
MP-safe.
ok claudio@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/syscalls.master | 4 | ||||
-rw-r--r-- | sys/kern/vfs_vnops.c | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index e3773768f34..4246004f64e 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,4 +1,4 @@ -; $OpenBSD: syscalls.master,v 1.210 2021/05/04 18:10:24 cheloha Exp $ +; $OpenBSD: syscalls.master,v 1.211 2021/05/06 12:55:20 anton Exp $ ; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -349,7 +349,7 @@ 197 STD { void *sys_mmap(void *addr, size_t len, int prot, \ int flags, int fd, long pad, off_t pos); } 198 INDIR { quad_t sys___syscall(quad_t num, ...); } -199 STD { off_t sys_lseek(int fd, int pad, off_t offset, \ +199 STD NOLOCK { off_t sys_lseek(int fd, int pad, off_t offset, \ int whence); } 200 STD { int sys_truncate(const char *path, int pad, \ off_t length); } diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 945b40935e2..f726d72f8cb 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.115 2021/04/28 09:53:53 claudio Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.116 2021/05/06 12:55:20 anton Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -657,7 +657,9 @@ vn_seek(struct file *fp, off_t *offset, int whence, struct proc *p) newoff = fp->f_offset + *offset; break; case SEEK_END: + KERNEL_LOCK(); error = VOP_GETATTR(vp, &vattr, cred, p); + KERNEL_UNLOCK(); if (error) goto out; newoff = *offset + (off_t)vattr.va_size; |