summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_mount.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2011-11-08 10:18:07 +0000
committerattilio <attilio@FreeBSD.org>2011-11-08 10:18:07 +0000
commit8e918ec4392cb32837f42437c386d9dfb54b257c (patch)
treeaad727fea4dcc49faa4e9a9a2e7735212da7d6c5 /sys/kern/vfs_mount.c
parentc3fe1633d0da1a6ef3d16c2308160a9f52d6a464 (diff)
downloadFreeBSD-src-8e918ec4392cb32837f42437c386d9dfb54b257c.zip
FreeBSD-src-8e918ec4392cb32837f42437c386d9dfb54b257c.tar.gz
Introduce the option VFS_ALLOW_NONMPSAFE and turn it on by default on
all the architectures. The option allows to mount non-MPSAFE filesystem. Without it, the kernel will refuse to mount a non-MPSAFE filesytem. This patch is part of the effort of killing non-MPSAFE filesystems from the tree. No MFC is expected for this patch. Tested by: gianni Reviewed by: kib
Diffstat (limited to 'sys/kern/vfs_mount.c')
-rw-r--r--sys/kern/vfs_mount.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 545a183..873f425 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -37,6 +37,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_vfs_allow_nonmpsafe.h"
+
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/fcntl.h>
@@ -798,6 +800,14 @@ vfs_domount_first(
* get. No freeing of cn_pnbuf.
*/
error = VFS_MOUNT(mp);
+#ifndef VFS_ALLOW_NONMPSAFE
+ if (error == 0 && VFS_NEEDSGIANT(mp)) {
+ (void)VFS_UNMOUNT(mp, fsflags);
+ error = ENXIO;
+ printf("%s: Mounting non-MPSAFE fs (%s) is disabled\n",
+ __func__, mp->mnt_vfc->vfc_name);
+ }
+#endif
if (error != 0) {
vfs_unbusy(mp);
vfs_mount_destroy(mp);
@@ -807,6 +817,11 @@ vfs_domount_first(
vrele(vp);
return (error);
}
+#ifdef VFS_ALLOW_NONMPSAFE
+ if (VFS_NEEDSGIANT(mp))
+ printf("%s: Mounting non-MPSAFE fs (%s) is deprecated\n",
+ __func__, mp->mnt_vfc->vfc_name);
+#endif
if (mp->mnt_opt != NULL)
vfs_freeopts(mp->mnt_opt);
OpenPOWER on IntegriCloud