[RFC] 'failok' mount(8) flag

Xin LI delphij at delphij.net
Mon Jun 6 18:00:36 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

I think sometimes it's desirable to mark a few file systems as 'failok',
which means it's Ok to have these mounts failed on boot and something
else (a script, cron job, etc) will handle the case.

Here is a proposed patch to implement that, I'll document it if there is
no objection on the functionality itself.

Cheers,
- -- 
Xin LI <delphij at delphij.net>	http://www.delphij.net/
FreeBSD - The Power to Serve!	       Live free or die
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (FreeBSD)

iQEcBAEBCAAGBQJN7RWxAAoJEATO+BI/yjfBEKEH/0yenOjZMhl3UdtUNDGs5UBN
v2Zhx3DcgvU4LCkwJEYYNXXCBYCKXMh0jBAYKhGUuKr8yOps74u9sHGDb278dn3+
hOOV/Xw4IZdjUGutezzRT8iImkVis4okEjuXX4fU/58y95jwIrcL7QXLGqerCsfe
n1U6T/RcIw5AB1R184+BxeuOEVhEl/siR8AdswKxc06UgkMPc3942WRCwHvfi2qz
44m9jYV+JM3Y2eYtriBRFlqdicbzbiUAXnLFtQigpl/bUKRUyXdfOaT94Jfy48uO
9LX6aNftF5rdfDKFfRKXnFbXjn/to4r+1H5ck8ZDsnShlYVlsQbZaTvD6cP8d4Y=
=VRq0
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: mount.c
===================================================================
--- mount.c	(revision 222765)
+++ mount.c	(working copy)
@@ -243,7 +243,7 @@
 	const char *mntfromname, **vfslist, *vfstype;
 	struct fstab *fs;
 	struct statfs *mntbuf;
-	int all, ch, i, init_flags, late, mntsize, rval, have_fstab, ro;
+	int all, ch, i, init_flags, late, failok, mntsize, rval, have_fstab, ro;
 	char *cp, *ep, *options;
 
 	all = init_flags = late = 0;
@@ -328,6 +328,10 @@
 					continue;
 				if (hasopt(fs->fs_mntops, "late") && !late)
 					continue;
+				if (hasopt(fs->fs_mntops, "failok"))
+					failok = 1;
+				else
+					failok = 0;
 				if (!(init_flags & MNT_UPDATE) &&
 				    ismounted(fs, mntbuf, mntsize))
 					continue;
@@ -335,7 +339,7 @@
 				    mntbuf->f_flags);
 				if (mountfs(fs->fs_vfstype, fs->fs_spec,
 				    fs->fs_file, init_flags, options,
-				    fs->fs_mntops))
+				    fs->fs_mntops) && !failok)
 					rval = 1;
 			}
 		} else if (fstab_style) {
@@ -717,6 +721,14 @@
 				 * before mountd starts.
 				 */
 				continue;
+			} else if (strcmp(p, "failok") == 0) {
+				/*
+				 * "failok" is used to prevent certain file
+				 * systems from being causing the system to
+				 * drop into single user mode in the boot
+				 * cycle, and is not a real mount option.
+				 */
+				continue;
 			} else if (strncmp(p, "mountprog", 9) == 0) {
 				/*
 				 * "mountprog" is used to force the use of


More information about the freebsd-current mailing list