diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-11-01 20:34:11 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-11-01 20:34:11 +0000 |
commit | 46c89706e243f21bc846a7e496ab5ce4db1768e8 (patch) | |
tree | e102318d5e077ab6ae6ec4102c459808f99728e7 /sys/kern/vfs_syscalls.c | |
parent | 55ec2536ce6c0d635a791013b3a21bd430cfb4c9 (diff) |
change vrele() to return an int. if it returns 0, it can gaurantee that
it did not sleep. this is used to avoid checkdirs() to avoid having
to restart the allproc walk every time through
idea from tedu, ok thib pedro
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 021bd8414f9..5f53eaeefdc 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.150 2008/10/31 16:49:17 deraadt Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.151 2008/11/01 20:34:09 deraadt Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -325,6 +325,7 @@ checkdirs(struct vnode *olddp) struct filedesc *fdp; struct vnode *newdp; struct proc *p; + int slept; if (olddp->v_usecount == 1) return; @@ -334,16 +335,18 @@ again: LIST_FOREACH(p, &allproc, p_list) { fdp = p->p_fd; if (fdp->fd_cdir == olddp) { - vrele(fdp->fd_cdir); + slept = vrele(fdp->fd_cdir); VREF(newdp); fdp->fd_cdir = newdp; - goto again; + if (slept) + goto again; } if (fdp->fd_rdir == olddp) { - vrele(fdp->fd_rdir); + slept = vrele(fdp->fd_rdir); VREF(newdp); fdp->fd_rdir = newdp; - goto again; + if (slept) + goto again; } } if (rootvnode == olddp) { |