From ed1f6dc2357a638c9cb09daaf750f727ebef03a8 Mon Sep 17 00:00:00 2001 From: Attilio Rao Date: Tue, 8 Nov 2011 10:18:07 +0000 Subject: [PATCH] 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 --- UPDATING | 6 ++++++ sys/amd64/conf/DEFAULTS | 3 +++ sys/arm/conf/DEFAULTS | 2 ++ sys/conf/NOTES | 3 +++ sys/conf/options | 1 + sys/i386/conf/DEFAULTS | 3 +++ sys/ia64/conf/DEFAULTS | 3 +++ sys/kern/vfs_mount.c | 15 +++++++++++++++ sys/mips/conf/DEFAULTS | 2 ++ sys/pc98/conf/DEFAULTS | 3 +++ sys/powerpc/conf/DEFAULTS | 3 +++ sys/sparc64/conf/DEFAULTS | 3 +++ 12 files changed, 47 insertions(+) diff --git a/UPDATING b/UPDATING index 1189f4c6edc1..dc17383414ef 100644 --- a/UPDATING +++ b/UPDATING @@ -22,6 +22,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW: machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20111108: + The option VFS_ALLOW_NONMPSAFE option has been added in order to + explicitely support non-MPSAFE filesystems. + It is on by default for all supported platform at this present + time. + 20111101: The broken amd(4) driver has been replaced with esp(4) in the amd64, i386 and pc98 GENERIC kernel configuration files. diff --git a/sys/amd64/conf/DEFAULTS b/sys/amd64/conf/DEFAULTS index 2c221cb76bb9..e39a9e49a58d 100644 --- a/sys/amd64/conf/DEFAULTS +++ b/sys/amd64/conf/DEFAULTS @@ -22,3 +22,6 @@ options GEOM_PART_EBR_COMPAT options GEOM_PART_MBR options NEW_PCIB + +# Allow mounting non-MPSAFE filesystems +options VFS_ALLOW_NONMPSAFE diff --git a/sys/arm/conf/DEFAULTS b/sys/arm/conf/DEFAULTS index 591a0a14c8de..3546d4e027bf 100644 --- a/sys/arm/conf/DEFAULTS +++ b/sys/arm/conf/DEFAULTS @@ -9,3 +9,5 @@ device mem options GEOM_PART_BSD options GEOM_PART_MBR + +options VFS_ALLOW_NONMPSAFE diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 882d49c3ee93..a3d33c2ad1c9 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -1104,6 +1104,9 @@ options XFS # unsuitable for inclusion on machines with untrusted local users. options VFS_AIO +# Enable mounting of non-MPSAFE filesystems. +options VFS_ALLOW_NONMPSAFE + # Cryptographically secure random number generator; /dev/random device random diff --git a/sys/conf/options b/sys/conf/options index 6ddecb8f7f53..61078bb58596 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -185,6 +185,7 @@ SYSVSHM opt_sysvipc.h SW_WATCHDOG opt_watchdog.h TURNSTILE_PROFILING VFS_AIO +VFS_ALLOW_NONMPSAFE VERBOSE_SYSINIT opt_global.h WLCACHE opt_wavelan.h WLDEBUG opt_wavelan.h diff --git a/sys/i386/conf/DEFAULTS b/sys/i386/conf/DEFAULTS index 78d807c3d344..1c5cd96c3460 100644 --- a/sys/i386/conf/DEFAULTS +++ b/sys/i386/conf/DEFAULTS @@ -30,3 +30,6 @@ options NATIVE device atpic options NEW_PCIB + +# Allow mounting non-MPSAFE filesystems +options VFS_ALLOW_NONMPSAFE diff --git a/sys/ia64/conf/DEFAULTS b/sys/ia64/conf/DEFAULTS index a3e10d614c67..e31e26b277d4 100644 --- a/sys/ia64/conf/DEFAULTS +++ b/sys/ia64/conf/DEFAULTS @@ -20,3 +20,6 @@ options GEOM_PART_GPT options GEOM_PART_MBR options NEW_PCIB + +# Allow mounting non-MPSAFE filesystems +options VFS_ALLOW_NONMPSAFE diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 545a183c1801..873f42527bf7 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -37,6 +37,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_vfs_allow_nonmpsafe.h" + #include #include #include @@ -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); diff --git a/sys/mips/conf/DEFAULTS b/sys/mips/conf/DEFAULTS index f09ef5440ce9..f015e89059a2 100644 --- a/sys/mips/conf/DEFAULTS +++ b/sys/mips/conf/DEFAULTS @@ -9,3 +9,5 @@ device uart_ns8250 options GEOM_PART_BSD options GEOM_PART_MBR + +options VFS_ALLOW_NONMPSAFE diff --git a/sys/pc98/conf/DEFAULTS b/sys/pc98/conf/DEFAULTS index 6c8b561841aa..342a6041344a 100644 --- a/sys/pc98/conf/DEFAULTS +++ b/sys/pc98/conf/DEFAULTS @@ -29,3 +29,6 @@ options GEOM_PART_PC98 device atpic options NEW_PCIB + +# Allow mounting non-MPSAFE filesystems +options VFS_ALLOW_NONMPSAFE diff --git a/sys/powerpc/conf/DEFAULTS b/sys/powerpc/conf/DEFAULTS index 658c2215d36f..54d194027f9f 100644 --- a/sys/powerpc/conf/DEFAULTS +++ b/sys/powerpc/conf/DEFAULTS @@ -12,3 +12,6 @@ device uart_z8530 options GEOM_PART_APM options GEOM_PART_MBR + +# Allow mounting non-MPSAFE filesystems +options VFS_ALLOW_NONMPSAFE diff --git a/sys/sparc64/conf/DEFAULTS b/sys/sparc64/conf/DEFAULTS index c99480c8f86f..f1305a8e445a 100644 --- a/sys/sparc64/conf/DEFAULTS +++ b/sys/sparc64/conf/DEFAULTS @@ -21,3 +21,6 @@ options GEOM_PART_VTOC8 options SUNKBD_EMULATE_ATKBD options NEW_PCIB + +# Allow mounting non-MPSAFE filesystems +options VFS_ALLOW_NONMPSAFE