In fchdir(), Giant must be separately acquired and dropped if the old

vnode is from a file system that is not MPSAFE, as vrele() expects
Giant to be held when it is called on a non-MPSAFE vnode.

Spotted by:	kris
Tested by:	glebius
This commit is contained in:
Robert Watson 2006-02-03 15:42:16 +00:00
parent 937a238777
commit 59428b0bad
2 changed files with 4 additions and 0 deletions

View File

@ -711,10 +711,12 @@ fchdir(td, uap)
return (error);
}
VOP_UNLOCK(vp, 0, td);
VFS_UNLOCK_GIANT(vfslocked);
FILEDESC_LOCK_FAST(fdp);
vpold = fdp->fd_cdir;
fdp->fd_cdir = vp;
FILEDESC_UNLOCK_FAST(fdp);
vfslocked = VFS_LOCK_GIANT(vpold->v_mount);
vrele(vpold);
VFS_UNLOCK_GIANT(vfslocked);
return (0);

View File

@ -711,10 +711,12 @@ fchdir(td, uap)
return (error);
}
VOP_UNLOCK(vp, 0, td);
VFS_UNLOCK_GIANT(vfslocked);
FILEDESC_LOCK_FAST(fdp);
vpold = fdp->fd_cdir;
fdp->fd_cdir = vp;
FILEDESC_UNLOCK_FAST(fdp);
vfslocked = VFS_LOCK_GIANT(vpold->v_mount);
vrele(vpold);
VFS_UNLOCK_GIANT(vfslocked);
return (0);