Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Jun 2011 18:48:49 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r222832 - in head: sbin/mount share/man/man5
Message-ID:  <201106071848.p57Imn3u096027@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Tue Jun  7 18:48:49 2011
New Revision: 222832
URL: http://svn.freebsd.org/changeset/base/222832

Log:
  Add a special mount option "failok" to indicate that the administrator wants
  the system to proceed to boot without bailing out into single user mode,
  even when the file system can not be successfully mounted.
  
  This option is implemented in mount(8) and not passed into kernel.
  
  MFC after:	1 month

Modified:
  head/sbin/mount/mount.c
  head/share/man/man5/fstab.5

Modified: head/sbin/mount/mount.c
==============================================================================
--- head/sbin/mount/mount.c	Tue Jun  7 18:43:02 2011	(r222831)
+++ head/sbin/mount/mount.c	Tue Jun  7 18:48:49 2011	(r222832)
@@ -243,7 +243,7 @@ main(int argc, char *argv[])
 	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 @@ main(int argc, char *argv[])
 					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 @@ main(int argc, char *argv[])
 				    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 @@ mangle(char *options, struct cpa *a)
 				 * 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

Modified: head/share/man/man5/fstab.5
==============================================================================
--- head/share/man/man5/fstab.5	Tue Jun  7 18:43:02 2011	(r222831)
+++ head/share/man/man5/fstab.5	Tue Jun  7 18:48:49 2011	(r222832)
@@ -32,7 +32,7 @@
 .\"     @(#)fstab.5	8.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd November 23, 2008
+.Dd June 7, 2011
 .Dt FSTAB 5
 .Os
 .Sh NAME
@@ -147,6 +147,13 @@ this location can be specified as:
 userquota=/var/quotas/tmp.user
 .Ed
 .Pp
+If the option ``failok'' is specified,
+the system will ignore any error which happens during the mount of that filesystem,
+which would otherwise cause the system to drop into single user mode.
+This option is implemented by the
+.Xr mount 8
+command and will not be passed to the kernel.
+.Pp
 If the option ``noauto'' is specified, the file system will not be automatically
 mounted at system startup.
 Note that, for network file systems



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106071848.p57Imn3u096027>