diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2008-11-11 02:11:26 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2008-11-11 02:11:26 +0000 |
commit | 1e3bcc3c27e2bb29f3f3cdd12b8f070007d1e858 (patch) | |
tree | d6ef01b92a8d6436b6522e4b3c467cda3158d497 | |
parent | bd775bed742c349f66465f004e7995567774b162 (diff) |
make sure that any messing we do with a process's directories happens atomically and not after sleeping.
ok deraadt pedro
-rw-r--r-- | sys/kern/vfs_syscalls.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 5f53eaeefdc..a36720daf91 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.151 2008/11/01 20:34:09 deraadt Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.152 2008/11/11 02:11:25 tedu Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -323,9 +323,8 @@ void checkdirs(struct vnode *olddp) { struct filedesc *fdp; - struct vnode *newdp; + struct vnode *newdp, *vp; struct proc *p; - int slept; if (olddp->v_usecount == 1) return; @@ -335,17 +334,17 @@ again: LIST_FOREACH(p, &allproc, p_list) { fdp = p->p_fd; if (fdp->fd_cdir == olddp) { - slept = vrele(fdp->fd_cdir); + vp = fdp->fd_cdir; VREF(newdp); fdp->fd_cdir = newdp; - if (slept) + if (vrele(vp)) goto again; } if (fdp->fd_rdir == olddp) { - slept = vrele(fdp->fd_rdir); + vp = fdp->fd_rdir; VREF(newdp); fdp->fd_rdir = newdp; - if (slept) + if (vrele(vp)) goto again; } } |