diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-10-25 10:24:55 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-10-25 10:24:55 +0000 |
commit | ef6c0e33aaa2b05046ebde5e0d676ef30b3aff08 (patch) | |
tree | 88a407868c23e0347cad7a9a225127b88f177469 /sys/kern | |
parent | a5a25d47cf802094233bfc5056a3ef1c7cae6c1a (diff) |
Revert commitid: ufM9BcSbXqfLpzBH;
Move vfs_stall_barrier() from the fd layer into vn_lock() and the vfs layer.
In some cases it can result in a deadlock while suspending.
Discussed with mpi@ and deraadt@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_descrip.c | 4 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 8 | ||||
-rw-r--r-- | sys/kern/vfs_vnops.c | 4 |
3 files changed, 7 insertions, 9 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index ea3e3399ce0..17d9deaf54d 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.203 2021/10/21 09:59:13 claudio Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.204 2021/10/25 10:24:54 claudio Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -232,6 +232,8 @@ fd_getfile(struct filedesc *fdp, int fd) { struct file *fp; + vfs_stall_barrier(); + if ((u_int)fd >= fdp->fd_nfiles) return (NULL); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index f8a300a3007..43a7cbd4ae9 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.312 2021/10/24 00:02:25 jsg Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.313 2021/10/25 10:24:54 claudio Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -1705,10 +1705,8 @@ void vfs_stall_barrier(void) { if (__predict_false(vfs_stalling)) { - if (curproc != RWLOCK_OWNER(&vfs_stall_lock)) { - rw_enter_read(&vfs_stall_lock); - rw_exit_read(&vfs_stall_lock); - } + rw_enter_read(&vfs_stall_lock); + rw_exit_read(&vfs_stall_lock); } } diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index de6d7593b14..5f89a6c2ef8 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.117 2021/10/21 09:59:14 claudio Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.118 2021/10/25 10:24:54 claudio Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -565,8 +565,6 @@ vn_lock(struct vnode *vp, int flags) { int error, xlocked, do_wakeup; - vfs_stall_barrier(); - do { mtx_enter(&vnode_mtx); if (vp->v_lflag & VXLOCK) { |