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
This commit is contained in:
Xin LI 2011-06-07 18:48:49 +00:00
parent c721b93449
commit c73830758a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=222832
2 changed files with 22 additions and 3 deletions

View File

@ -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

View File

@ -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