- Pass LK_EXCLUSIVE to VFS_ROOT() to satisfy the new flags argument. For

now, all calls to VFS_ROOT() should still acquire exclusive locks.

Sponsored by:	Isilon Systems, Inc.
This commit is contained in:
jeff 2005-03-24 07:31:38 +00:00
parent 5528d705e8
commit 0210925e42
6 changed files with 12 additions and 10 deletions

View File

@ -301,7 +301,7 @@ vfs_setpublicfs(mp, nep, argp)
bzero(&nfs_pub.np_handle, sizeof(nfs_pub.np_handle));
nfs_pub.np_handle.fh_fsid = mp->mnt_stat.f_fsid;
if ((error = VFS_ROOT(mp, &rvp, curthread /* XXX */)))
if ((error = VFS_ROOT(mp, LK_EXCLUSIVE, &rvp, curthread /* XXX */)))
return (error);
if ((error = VFS_VPTOFH(rvp, &nfs_pub.np_handle.fh_fid)))

View File

@ -689,7 +689,7 @@ fchdir(td, uap)
if (vfs_busy(mp, 0, 0, td))
continue;
tvfslocked = VFS_LOCK_GIANT(mp);
error = VFS_ROOT(mp, &tdp, td);
error = VFS_ROOT(mp, LK_EXCLUSIVE, &tdp, td);
vfs_unbusy(mp, td);
if (error) {
VFS_UNLOCK_GIANT(tvfslocked);

View File

@ -584,7 +584,7 @@ unionlookup:
continue;
VOP_UNLOCK(dp, 0, td);
tvfslocked = VFS_LOCK_GIANT(mp);
error = VFS_ROOT(mp, &tdp, td);
error = VFS_ROOT(mp, LK_EXCLUSIVE, &tdp, td);
vfs_unbusy(mp, td);
if (error) {
VFS_UNLOCK_GIANT(tvfslocked);

View File

@ -785,7 +785,7 @@ vfs_domount(
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
mtx_unlock(&mountlist_mtx);
vfs_event_signal(NULL, VQ_MOUNT, 0);
if (VFS_ROOT(mp, &newdp, td))
if (VFS_ROOT(mp, LK_EXCLUSIVE, &newdp, td))
panic("mount: lost mount");
mountcheckdirs(vp, newdp);
vput(newdp);
@ -946,7 +946,8 @@ dounmount(mp, flags, td)
* vnode to the covered vnode. For non-forced unmounts we want
* such references to cause an EBUSY error.
*/
if ((flags & MNT_FORCE) && VFS_ROOT(mp, &fsrootvp, td) == 0) {
if ((flags & MNT_FORCE) &&
VFS_ROOT(mp, LK_EXCLUSIVE, &fsrootvp, td) == 0) {
if (mp->mnt_vnodecovered != NULL)
mountcheckdirs(fsrootvp, mp->mnt_vnodecovered);
if (fsrootvp == rootvnode) {
@ -963,7 +964,8 @@ dounmount(mp, flags, td)
vn_finished_write(mp);
if (error) {
/* Undo cdir/rdir and rootvnode changes made above. */
if ((flags & MNT_FORCE) && VFS_ROOT(mp, &fsrootvp, td) == 0) {
if ((flags & MNT_FORCE) &&
VFS_ROOT(mp, LK_EXCLUSIVE, &fsrootvp, td) == 0) {
if (mp->mnt_vnodecovered != NULL)
mountcheckdirs(mp->mnt_vnodecovered, fsrootvp);
if (rootvnode == NULL) {
@ -1006,7 +1008,7 @@ set_rootvnode(struct thread *td)
{
struct proc *p;
if (VFS_ROOT(TAILQ_FIRST(&mountlist), &rootvnode, td))
if (VFS_ROOT(TAILQ_FIRST(&mountlist), LK_EXCLUSIVE, &rootvnode, td))
panic("Cannot find root vnode");
p = td->td_proc;
@ -1087,7 +1089,7 @@ devfs_fixup(struct thread *td)
mtx_unlock(&mountlist_mtx);
cache_purgevfs(mp);
VFS_ROOT(mp, &dvp, td);
VFS_ROOT(mp, LK_EXCLUSIVE, &dvp, td);
VI_LOCK(dvp);
dvp->v_iflag &= ~VI_MOUNT;
dvp->v_mountedhere = NULL;

View File

@ -2053,7 +2053,7 @@ vflush(mp, rootrefs, flags, td)
* Get the filesystem root vnode. We can vput() it
* immediately, since with rootrefs > 0, it won't go away.
*/
if ((error = VFS_ROOT(mp, &rootvp, td)) != 0)
if ((error = VFS_ROOT(mp, LK_EXCLUSIVE, &rootvp, td)) != 0)
return (error);
vput(rootvp);

View File

@ -689,7 +689,7 @@ fchdir(td, uap)
if (vfs_busy(mp, 0, 0, td))
continue;
tvfslocked = VFS_LOCK_GIANT(mp);
error = VFS_ROOT(mp, &tdp, td);
error = VFS_ROOT(mp, LK_EXCLUSIVE, &tdp, td);
vfs_unbusy(mp, td);
if (error) {
VFS_UNLOCK_GIANT(tvfslocked);