pwd: unbreak repeated calls to set_rootvnode
Prior to the change the once set pointer would never be updated. Unbreaks reboot -r. Reported by: Ross Gohlke
This commit is contained in:
parent
6844522a9a
commit
21d3be9105
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=360374
@ -3475,6 +3475,27 @@ pwd_ensure_dirs(void)
|
||||
pwd_drop(oldpwd);
|
||||
}
|
||||
|
||||
void
|
||||
pwd_set_rootvnode(void)
|
||||
{
|
||||
struct filedesc *fdp;
|
||||
struct pwd *oldpwd, *newpwd;
|
||||
|
||||
fdp = curproc->p_fd;
|
||||
|
||||
newpwd = pwd_alloc();
|
||||
FILEDESC_XLOCK(fdp);
|
||||
oldpwd = FILEDESC_XLOCKED_LOAD_PWD(fdp);
|
||||
vrefact(rootvnode);
|
||||
newpwd->pwd_cdir = rootvnode;
|
||||
vrefact(rootvnode);
|
||||
newpwd->pwd_rdir = rootvnode;
|
||||
pwd_fill(oldpwd, newpwd);
|
||||
pwd_set(fdp, newpwd);
|
||||
FILEDESC_XUNLOCK(fdp);
|
||||
pwd_drop(oldpwd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Scan all active processes and prisons to see if any of them have a current
|
||||
* or root directory of `olddp'. If so, replace them with the new mount point.
|
||||
|
@ -243,7 +243,7 @@ set_rootvnode(void)
|
||||
|
||||
VOP_UNLOCK(rootvnode);
|
||||
|
||||
pwd_ensure_dirs();
|
||||
pwd_set_rootvnode();
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -298,6 +298,7 @@ fd_modified(struct filedesc *fdp, int fd, seqc_t seqc)
|
||||
void pwd_chdir(struct thread *td, struct vnode *vp);
|
||||
int pwd_chroot(struct thread *td, struct vnode *vp);
|
||||
void pwd_ensure_dirs(void);
|
||||
void pwd_set_rootvnode(void);
|
||||
|
||||
struct pwd *pwd_hold_filedesc(struct filedesc *fdp);
|
||||
struct pwd *pwd_hold(struct thread *td);
|
||||
|
Loading…
Reference in New Issue
Block a user