Introduce and use new flag -L to mount for mounting only late filesystems.

Previously, rc.d/mountlate mounted *all* filesystems, causing problems with
background NFS mounts being mounted twice.

PR:		conf/137629
Submitted by:	eadler (original concept)
Reviewed by:	mjg
Approved by:	hrs
This commit is contained in:
Chris Rees 2013-05-04 14:00:16 +00:00
parent c951cd462f
commit b48b774f99
3 changed files with 20 additions and 15 deletions

View File

@ -21,19 +21,10 @@ mountlate_start()
# Mount "late" filesystems. # Mount "late" filesystems.
# #
err=0 err=0
latefs=
# / (root) fs is always remounted, so remove from list
latefs="`/sbin/mount -d -a -l | grep -v ' /$'`"
case ${latefs} in
'')
;;
*)
echo -n 'Mounting late file systems:' echo -n 'Mounting late file systems:'
mount -a -l mount -a -L
err=$? err=$?
echo '.' echo '.'
;;
esac
case ${err} in case ${err} in
0) 0)

View File

@ -106,6 +106,13 @@ a file system mount status from read-write to read-only.
Also Also
forces the R/W mount of an unclean file system (dangerous; use with forces the R/W mount of an unclean file system (dangerous; use with
caution). caution).
.It Fl L
When used in conjunction with the
.Fl a
option, mount
.Em only
those file systems which are marked as
.Dq Li late .
.It Fl l .It Fl l
When used in conjunction with the When used in conjunction with the
.Fl a .Fl a

View File

@ -245,14 +245,15 @@ main(int argc, char *argv[])
struct fstab *fs; struct fstab *fs;
struct statfs *mntbuf; struct statfs *mntbuf;
int all, ch, i, init_flags, late, failok, mntsize, rval, have_fstab, ro; int all, ch, i, init_flags, late, failok, mntsize, rval, have_fstab, ro;
int onlylate;
char *cp, *ep, *options; char *cp, *ep, *options;
all = init_flags = late = 0; all = init_flags = late = onlylate = 0;
ro = 0; ro = 0;
options = NULL; options = NULL;
vfslist = NULL; vfslist = NULL;
vfstype = "ufs"; vfstype = "ufs";
while ((ch = getopt(argc, argv, "adF:flo:prt:uvw")) != -1) while ((ch = getopt(argc, argv, "adF:fLlo:prt:uvw")) != -1)
switch (ch) { switch (ch) {
case 'a': case 'a':
all = 1; all = 1;
@ -266,6 +267,10 @@ main(int argc, char *argv[])
case 'f': case 'f':
init_flags |= MNT_FORCE; init_flags |= MNT_FORCE;
break; break;
case 'L':
onlylate = 1;
late = 1;
break;
case 'l': case 'l':
late = 1; late = 1;
break; break;
@ -327,6 +332,8 @@ main(int argc, char *argv[])
continue; continue;
if (hasopt(fs->fs_mntops, "noauto")) if (hasopt(fs->fs_mntops, "noauto"))
continue; continue;
if (!hasopt(fs->fs_mntops, "late") && onlylate)
continue;
if (hasopt(fs->fs_mntops, "late") && !late) if (hasopt(fs->fs_mntops, "late") && !late)
continue; continue;
if (hasopt(fs->fs_mntops, "failok")) if (hasopt(fs->fs_mntops, "failok"))