Refuse attemps to mount root filesystem

This commit is contained in:
Poul-Henning Kamp 2004-11-09 22:14:57 +00:00
parent 16c2bf8bfb
commit b0aed5267e
4 changed files with 6 additions and 2 deletions

View File

@ -68,7 +68,7 @@ devfs_mount(struct mount *mp, struct thread *td)
error = 0;
if (mp->mnt_flag & (MNT_UPDATE | MNT_NODEV))
if (mp->mnt_flag & (MNT_UPDATE | MNT_NODEV | MNT_ROOTFS))
return (EOPNOTSUPP);
MALLOC(fmp, struct devfs_mount *, sizeof(struct devfs_mount),

View File

@ -71,7 +71,7 @@ fdesc_mount(struct mount *mp, struct thread *td)
/*
* Update is a no-op
*/
if (mp->mnt_flag & MNT_UPDATE)
if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS))
return (EOPNOTSUPP);
error = fdesc_allocvp(Froot, FD_ROOT, mp, &rvp, td);

View File

@ -225,6 +225,8 @@ hpfs_mountfs(devvp, mp, argsp, td)
struct g_consumer *cp;
struct bufobj *bo;
if (mp->mnt_flag & MNT_ROOTFS)
return (EOPNOTSUPP);
dprintf(("hpfs_mountfs():\n"));
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);

View File

@ -364,6 +364,8 @@ mountmsdosfs(devvp, mp, td, argp)
struct g_consumer *cp;
struct bufobj *bo;
if (mp->mnt_flag & MNT_ROOTFS)
return (EOPNOTSUPP);
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
/* XXX: use VOP_ACCESS to check FS perms */
DROP_GIANT();