In nmount(), if MNT_ROOT is in the mount flags, filter it
out instead of returning an error. (1) This makes the behavior consistent with mount(2). (2) This makes update mounts on the root file system work properly. (3) The explicit checks for MNT_ROOTFS in src/sbin/fsck_ffs/main.c and src/usr.sbin/mountd/mountd.c which were put in to eliminate errors during update mounts on the root file system can be removed. The only place were MNT_ROOTFS can be validly set is inside the kernel, i.e. with vfs_mountroot_try(). Reviewed by: phk MFC after: 3 days
This commit is contained in:
parent
1bd6756d35
commit
0b0826633e
@ -387,9 +387,13 @@ nmount(td, uap)
|
||||
|
||||
AUDIT_ARG(fflags, uap->flags);
|
||||
|
||||
/* Kick out MNT_ROOTFS early as it is legal internally */
|
||||
if (uap->flags & MNT_ROOTFS)
|
||||
return (EINVAL);
|
||||
/*
|
||||
* Filter out MNT_ROOTFS. We do not want clients of nmount() in
|
||||
* userspace to set this flag, but we must filter it out if we want
|
||||
* MNT_UPDATE on the root file system to work.
|
||||
* MNT_ROOTFS should only be set in the kernel in vfs_mountroot_try().
|
||||
*/
|
||||
uap->flags &= ~MNT_ROOTFS;
|
||||
|
||||
iovcnt = uap->iovcnt;
|
||||
/*
|
||||
@ -769,7 +773,12 @@ mount(td, uap)
|
||||
|
||||
AUDIT_ARG(fflags, uap->flags);
|
||||
|
||||
/* Kick out MNT_ROOTFS early as it is legal internally */
|
||||
/*
|
||||
* Filter out MNT_ROOTFS. We do not want clients of mount() in
|
||||
* userspace to set this flag, but we must filter it out if we want
|
||||
* MNT_UPDATE on the root file system to work.
|
||||
* MNT_ROOTFS should only be set in the kernel in vfs_mountroot_try().
|
||||
*/
|
||||
uap->flags &= ~MNT_ROOTFS;
|
||||
|
||||
fstype = malloc(MFSNAMELEN, M_TEMP, M_WAITOK);
|
||||
|
Loading…
Reference in New Issue
Block a user