diff options
author | crees <crees@FreeBSD.org> | 2013-05-04 14:00:16 +0000 |
---|---|---|
committer | crees <crees@FreeBSD.org> | 2013-05-04 14:00:16 +0000 |
commit | 6473a2540f9533d31ae4872e4485cd1f7eb2e402 (patch) | |
tree | 976207f2d40cd292429359556af3586f3a48de79 /sbin/mount | |
parent | 17f70d0a20fae6165cde9154414f54d76b99057d (diff) | |
download | FreeBSD-src-6473a2540f9533d31ae4872e4485cd1f7eb2e402.zip FreeBSD-src-6473a2540f9533d31ae4872e4485cd1f7eb2e402.tar.gz |
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
Diffstat (limited to 'sbin/mount')
-rw-r--r-- | sbin/mount/mount.8 | 7 | ||||
-rw-r--r-- | sbin/mount/mount.c | 11 |
2 files changed, 16 insertions, 2 deletions
diff --git a/sbin/mount/mount.8 b/sbin/mount/mount.8 index 6bc4b5c..2770658 100644 --- a/sbin/mount/mount.8 +++ b/sbin/mount/mount.8 @@ -106,6 +106,13 @@ a file system mount status from read-write to read-only. Also forces the R/W mount of an unclean file system (dangerous; use with 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 When used in conjunction with the .Fl a diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 1984eac..a156089 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -245,14 +245,15 @@ main(int argc, char *argv[]) struct fstab *fs; struct statfs *mntbuf; int all, ch, i, init_flags, late, failok, mntsize, rval, have_fstab, ro; + int onlylate; char *cp, *ep, *options; - all = init_flags = late = 0; + all = init_flags = late = onlylate = 0; ro = 0; options = NULL; vfslist = NULL; vfstype = "ufs"; - while ((ch = getopt(argc, argv, "adF:flo:prt:uvw")) != -1) + while ((ch = getopt(argc, argv, "adF:fLlo:prt:uvw")) != -1) switch (ch) { case 'a': all = 1; @@ -266,6 +267,10 @@ main(int argc, char *argv[]) case 'f': init_flags |= MNT_FORCE; break; + case 'L': + onlylate = 1; + late = 1; + break; case 'l': late = 1; break; @@ -327,6 +332,8 @@ main(int argc, char *argv[]) continue; if (hasopt(fs->fs_mntops, "noauto")) continue; + if (!hasopt(fs->fs_mntops, "late") && onlylate) + continue; if (hasopt(fs->fs_mntops, "late") && !late) continue; if (hasopt(fs->fs_mntops, "failok")) |