mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
make sure that any messing we do with a process's directories happens atomically and not after sleeping.
ok deraadt pedro
This commit is contained in:
parent
93e859c46a
commit
7f4c1854d7
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user