1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

Assert Giant held in vfs_domount() and vfs_dounmount()

Explicitly grab Giant before calling these.
This commit is contained in:
Poul-Henning Kamp 2004-11-25 12:06:43 +00:00
parent 7b54cdda4e
commit 19da2efc3e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138087

View File

@ -576,7 +576,9 @@ vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions)
goto bail;
}
mtx_lock(&Giant);
error = vfs_domount(td, fstype, fspath, fsflags, optlist, 0);
mtx_unlock(&Giant);
bail:
if (error)
vfs_freeopts(optlist);
@ -619,9 +621,12 @@ mount(td, uap)
error = copyinstr(uap->type, fstype, MFSNAMELEN, NULL);
if (error == 0)
error = copyinstr(uap->path, fspath, MNAMELEN, NULL);
if (error == 0)
if (error == 0) {
mtx_lock(&Giant);
error = vfs_domount(td, fstype, fspath, uap->flags,
uap->data, 1);
mtx_unlock(&Giant);
}
free(fstype, M_TEMP);
free(fspath, M_TEMP);
return (error);
@ -643,8 +648,12 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata)
int fsflags;
void *fsdata;
{
int error;
return (vfs_domount(td, fstype, fspath, fsflags, fsdata, 1));
mtx_lock(&Giant);
error = vfs_domount(td, fstype, fspath, fsflags, fsdata, 1);
mtx_unlock(&Giant);
return (error);
}
/*
@ -668,6 +677,8 @@ vfs_domount(
struct vattr va;
struct nameidata nd;
mtx_assert(&Giant, MA_OWNED);
/*
* Be ultra-paranoid about making sure the type and fspath
* variables will fit in our mp buffers, including the
@ -1067,7 +1078,10 @@ unmount(td, uap)
*/
if (mp->mnt_flag & MNT_ROOTFS)
return (EINVAL);
return (dounmount(mp, uap->flags, td));
mtx_lock(&Giant);
error = dounmount(mp, uap->flags, td);
mtx_unlock(&Giant);
return (error);
}
/*
@ -1083,6 +1097,8 @@ dounmount(mp, flags, td)
int error;
int async_flag;
mtx_assert(&Giant, MA_OWNED);
mtx_lock(&mountlist_mtx);
if (mp->mnt_kern_flag & MNTK_UNMOUNT) {
mtx_unlock(&mountlist_mtx);
@ -1568,6 +1584,7 @@ __mnt_vnode_next(struct vnode **nvp, struct mount *mp)
struct vnode *vp;
mtx_assert(&mp->mnt_mtx, MA_OWNED);
vp = *nvp;
/* Check if we are done */
if (vp == NULL)