mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
8bb84cef37
commit
b4b5bf359b
1 changed files with 13 additions and 4 deletions
|
|
@ -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 a new issue