From owner-freebsd-rc@FreeBSD.ORG Wed Jul 12 10:33:09 2006 Return-Path: X-Original-To: rc@freebsd.org Delivered-To: freebsd-rc@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1EE4E16A4DA for ; Wed, 12 Jul 2006 10:33:09 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2E45343D94 for ; Wed, 12 Jul 2006 10:32:51 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id D624F2085; Wed, 12 Jul 2006 12:32:46 +0200 (CEST) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: 0.1/3.0 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on tim.des.no Received: from xps.des.no (des.no [80.203.243.180]) by tim.des.no (Postfix) with ESMTP id 525872082; Wed, 12 Jul 2006 12:32:46 +0200 (CEST) Received: by xps.des.no (Postfix, from userid 1001) id 1A62D33C31; Wed, 12 Jul 2006 12:32:46 +0200 (CEST) From: des@des.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) To: Brooks Davis References: <86odvwzjjz.fsf@xps.des.no> <20060711155312.GA20418@odin.ac.hmc.edu> <86ac7gqeal.fsf@xps.des.no> <20060711165409.GA459@odin.ac.hmc.edu> Date: Wed, 12 Jul 2006 12:32:45 +0200 In-Reply-To: <20060711165409.GA459@odin.ac.hmc.edu> (Brooks Davis's message of "Tue, 11 Jul 2006 09:54:09 -0700") Message-ID: <86hd1ndsfm.fsf@xps.des.no> User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: rc@freebsd.org Subject: Re: loopback mounts X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2006 10:33:09 -0000 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Brooks Davis writes: > On Tue, Jul 11, 2006 at 06:47:30PM +0200, Dag-Erling Sm=F8rgrav wrote: > > You don't need any extra fields - just add "late" to the options > > column and teach mount(8) to ignore it. > Sorry, poor terminology on my part. That's what I meant to suggest. OK, see attached patch. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=mountlate.diff Index: sbin/mount/mount.8 =================================================================== RCS file: /home/ncvs/src/sbin/mount/mount.8,v retrieving revision 1.77 diff -u -r1.77 mount.8 --- sbin/mount/mount.8 19 May 2006 00:04:18 -0000 1.77 +++ sbin/mount/mount.8 12 Jul 2006 06:43:28 -0000 @@ -28,7 +28,7 @@ .\" @(#)mount.8 8.8 (Berkeley) 6/16/94 .\" $FreeBSD: src/sbin/mount/mount.8,v 1.77 2006/05/19 00:04:18 rodrigc Exp $ .\" -.Dd November 26, 2004 +.Dd July 12, 2006 .Dt MOUNT 8 .Os .Sh NAME @@ -36,7 +36,7 @@ .Nd mount file systems .Sh SYNOPSIS .Nm -.Op Fl adfpruvw +.Op Fl adflpruvw .Op Fl F Ar fstab .Op Fl o Ar options .Op Fl t Ar ufs | external_type @@ -78,7 +78,12 @@ are mounted. Exceptions are those marked as .Dq noauto , -excluded by the +those marked as +.Dq late +(unless the +.Fl l +option was specified), +those excluded by the .Fl t flag (see below), or if they are already mounted (except the root file system which is always remounted to preserve @@ -101,6 +106,15 @@ 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, also mount those file systems which are marked as +.Dq late . +.Xr fstab 5 +marked as +.Dq late +are mounted. .It Fl o Options are specified with a .Fl o @@ -142,6 +156,13 @@ flag, this is the same as specifying all the options listed in the .Xr fstab 5 file for the file system. +.It Cm late +This file system should be skipped when +.Nm is run with the +.Fl a +flag but without the +.Fl l +flag. .It Cm multilabel Enable multi-label Mandatory Access Control, or MAC, on the specified file system. Index: sbin/mount/mount.c =================================================================== RCS file: /home/ncvs/src/sbin/mount/mount.c,v retrieving revision 1.87 diff -u -r1.87 mount.c --- sbin/mount/mount.c 10 Jun 2006 01:44:57 -0000 1.87 +++ sbin/mount/mount.c 12 Jul 2006 06:40:26 -0000 @@ -191,17 +191,17 @@ struct statfs *mntbuf; FILE *mountdfp; pid_t pid; - int all, ch, i, init_flags, mntsize, rval, have_fstab; + int all, ch, i, init_flags, late, mntsize, rval, have_fstab; char *cp, *ep, *options; options = strdup("noro"); if (options == NULL) errx(1, "malloc failed"); - all = init_flags = 0; + all = init_flags = late = 0; vfslist = NULL; vfstype = "ufs"; - while ((ch = getopt(argc, argv, "adF:fo:prwt:uv")) != -1) + while ((ch = getopt(argc, argv, "adlF:fo:prwt:uv")) != -1) switch (ch) { case 'a': all = 1; @@ -215,6 +215,9 @@ case 'f': init_flags |= MNT_FORCE; break; + case 'l': + late = 1; + break; case 'o': options = catopt(options, optarg); break; @@ -265,6 +268,8 @@ continue; if (hasopt(fs->fs_mntops, "noauto")) continue; + if (hasopt(fs->fs_mntops, "late") && !late) + continue; if (!(init_flags & MNT_UPDATE) && ismounted(fs, mntbuf, mntsize)) continue; @@ -628,6 +633,15 @@ * not a real mount option. */ continue; + } else if (strcmp(p, "late") == 0) { + /* + * "late" is used to prevent certain file + * systems from being mounted before late + * in the boot cycle; for instance, + * loopback NFS mounts can't be mounted + * before mountd starts. + */ + continue; } else if (strcmp(p, "userquota") == 0) { continue; } else if (strncmp(p, userquotaeq, @@ -737,7 +751,7 @@ { (void)fprintf(stderr, "%s\n%s\n%s\n", -"usage: mount [-adfpruvw] [-F fstab] [-o options] [-t ufs | external_type]", +"usage: mount [-adflpruvw] [-F fstab] [-o options] [-t ufs | external_type]", " mount [-dfpruvw] special | node", " mount [-dfpruvw] [-o options] [-t ufs | external_type] special node"); exit(1); Index: etc/rc.d/Makefile =================================================================== RCS file: /home/ncvs/src/etc/rc.d/Makefile,v retrieving revision 1.73 diff -u -r1.73 Makefile --- etc/rc.d/Makefile 1 Jun 2006 11:01:54 -0000 1.73 +++ etc/rc.d/Makefile 12 Jul 2006 07:17:35 -0000 @@ -21,7 +21,7 @@ jail \ kadmind kerberos kernel keyserv kldxref kpasswdd \ ldconfig local localpkg lpd \ - mixer motd mountcritlocal mountcritremote \ + mixer motd mountcritlocal mountcritremote mountlate \ mdconfig mdconfig2 mountd moused mroute6d mrouted msgs \ named natd netif netoptions \ network_ipv6 newsyslog nfsclient nfsd \ Index: etc/rc.d/mountlate =================================================================== RCS file: etc/rc.d/mountlate diff -N etc/rc.d/mountlate --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ etc/rc.d/mountlate 12 Jul 2006 07:17:13 -0000 @@ -0,0 +1,34 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: mountlate +# REQUIRE: mountd +# BEFORE: DAEMON +# KEYWORD: nojail + +. /etc/rc.subr + +name="mountlate" +start_cmd="mountlate_start" +stop_cmd=":" + +mountlate_start() +{ + # Mount "late" filesystems. + mount -a -l + + case $? in + 0) + ;; + *) + echo 'Mounting /etc/fstab filesystems failed,' \ + ' startup aborted' + kill -QUIT $$ + ;; + esac +} + +load_rc_config $name +run_rc_command "$1" --=-=-=--