Use shared vnode locks for fchdir().

Submitted by:	ups
This commit is contained in:
jhb 2009-01-23 22:13:30 +00:00
parent d7c8a44c0d
commit d94da54d95

View File

@ -758,7 +758,7 @@ fchdir(td, uap)
VREF(vp);
fdrop(fp, td);
vfslocked = VFS_LOCK_GIANT(vp->v_mount);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
vn_lock(vp, LK_SHARED | LK_RETRY);
AUDIT_ARG(vnode, vp, ARG_VNODE1);
error = change_dir(vp, td);
while (!error && (mp = vp->v_mountedhere) != NULL) {
@ -766,7 +766,7 @@ fchdir(td, uap)
if (vfs_busy(mp, 0))
continue;
tvfslocked = VFS_LOCK_GIANT(mp);
error = VFS_ROOT(mp, LK_EXCLUSIVE, &tdp, td);
error = VFS_ROOT(mp, LK_SHARED, &tdp, td);
vfs_unbusy(mp);
if (error) {
VFS_UNLOCK_GIANT(tvfslocked);