summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_mount.c
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2007-10-27 15:59:18 +0000
committerrodrigc <rodrigc@FreeBSD.org>2007-10-27 15:59:18 +0000
commit0b0826633ebc1ec3f6feb3b32e1c7a373b73fe5a (patch)
tree922c82db3a407846f644091b408d43b4d8aea0df /sys/kern/vfs_mount.c
parent1bd6756d350773fa18df92a2937e9fa1903415ca (diff)
downloadFreeBSD-src-0b0826633ebc1ec3f6feb3b32e1c7a373b73fe5a.zip
FreeBSD-src-0b0826633ebc1ec3f6feb3b32e1c7a373b73fe5a.tar.gz
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
Diffstat (limited to 'sys/kern/vfs_mount.c')
-rw-r--r--sys/kern/vfs_mount.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index e8fbd50..3628b3b 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -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);
OpenPOWER on IntegriCloud