Refuse attempts to mount root filesystem

This commit is contained in:
Poul-Henning Kamp 2004-11-09 22:21:10 +00:00
parent b0aed5267e
commit 64042a76b6
7 changed files with 11 additions and 6 deletions

View File

@ -85,6 +85,8 @@ nullfs_mount(struct mount *mp, struct thread *td)
NULLFSDEBUG("nullfs_mount(mp = %p)\n", (void *)mp);
if (mp->mnt_flag & MNT_ROOTFS)
return (EOPNOTSUPP);
/*
* Update is a no-op
*/

View File

@ -147,6 +147,8 @@ static int nwfs_omount(struct mount *mp, char *path, caddr_t data,
struct vnode *vp;
char *pc,*pe;
if (mp->mnt_flag & MNT_ROOTFS)
return (EOPNOTSUPP);
if (data == NULL) {
nwfs_printf("missing data argument\n");
return 1;

View File

@ -85,7 +85,7 @@ portal_omount(mp, path, data, td)
/*
* Update is a no-op
*/
if (mp->mnt_flag & MNT_UPDATE)
if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS))
return (EOPNOTSUPP);
error = copyin(data, (caddr_t) &args, sizeof(struct portal_args));

View File

@ -122,10 +122,9 @@ smbfs_omount(struct mount *mp, char *path, caddr_t data, struct thread *td)
printf("missing data argument\n");
return EINVAL;
}
if (mp->mnt_flag & MNT_UPDATE) {
printf("MNT_UPDATE not implemented");
if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS))
return EOPNOTSUPP;
}
error = copyin(data, (caddr_t)&args, sizeof(struct smbfs_args));
if (error)
return error;

View File

@ -99,7 +99,7 @@ umapfs_omount(mp, path, data, ndp, td)
/*
* Update is a no-op
*/
if (mp->mnt_flag & MNT_UPDATE) {
if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS)) {
return (EOPNOTSUPP);
/* return (VFS_MOUNT(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, path, data, ndp, td));*/
}

View File

@ -89,6 +89,8 @@ union_mount(mp, td)
*/
mp->mnt_flag |= MNT_NOCLUSTERW;
if (mp->mnt_flag & MNT_ROOTFS)
return (EOPNOTSUPP);
/*
* Update is a no-op
*/

View File

@ -393,7 +393,7 @@ nfs_omount(struct mount *mp, char *path, caddr_t data, struct thread *td)
char hst[MNAMELEN];
size_t len;
if (path == NULL) {
if (mp->mnt_flag & MNT_ROOTFS) {
printf("NFSv4: nfs_mountroot not supported\n");
return EINVAL;
}