Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Apr 2001 11:11:51 -0400
From:      Brian Dean <bsd@bsdhome.com>
To:        Luigi Rizzo <luigi@info.iet.unipi.it>
Cc:        "David E. Cross" <crossd@cs.rpi.edu>, Sven Huster <sven.huster@mailsurf.com>, Jordan Hubbard <jkh@osd.bsdi.com>, stable@FreeBSD.ORG, developers@FreeBSD.ORG
Subject:   Re: FreeBSD 4.3-RC5 now on ftp.freebsd.org
Message-ID:  <20010420111151.A55293@vger.bsdhome.com>
In-Reply-To: <200104192325.BAA63867@info.iet.unipi.it>; from luigi@info.iet.unipi.it on Fri, Apr 20, 2001 at 01:25:07AM %2B0200
References:  <200104192001.QAA60154@cs.rpi.edu> <200104192325.BAA63867@info.iet.unipi.it>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Apr 20, 2001 at 01:25:07AM +0200, Luigi Rizzo wrote:
> [Jordan, in case we reach consensus on what to do and can test
> patches before the release's cut date, do we have permission to
> update rc.diskless{1,2} as needed ? These files are not on a critical
> part of the system so commits in this area do not pose stability
> problems.]
> 
> I had a look at Sven's patches, and there is one thing that puzzles
> me: when doing the mount_mfs of /etc and restoring files, the
> OS has still handles open on the old /etc/rc and /etc/rc.diskless1 .
> 
> What happens on subsequent reads from these files (which are long) ?
> Do they refer to the old version, the new one, or what ?
> 
> The problem did not arise with mount_null because themount was simply
> an overlay so (unless the user would override those files as well)
> it was clear that the reverence was to the old one.
> 
> That said: i read the recent commit logs for nullfs in -current,
> ant it seems to be fixed there, unfortunately i have no idea
> how hard it is to backport the fixes, some of the diffs are
> trivial to understand, some are beyond my (very limited)
> understanding of this part of the kernel.
> 
> As for stability of the diskless clients:
> with the current version of rc.diskless2 in -stable, the only part
> which uses mount_null is /etc/ where hopefully nothing gets written
> to after the pass in /etc/rc.diskless1 so it should not be
> a terrible stability issue.
> 
> 	cheers
> 	luigi

Hi,

I haven't seen Sven's patches, but the following works well here for
me.  The following patch eliminates the null mount by first copying
/etc/* to /tmp/etc, then we mount /etc as an MFS, then copy back from
/tmp/etc.  The rest of the code proceeds as normal except that copies
from /conf/*/etc go directly to /etc.

This works well here and does not suffer the problems of the null
mount.  For example, one can run pwd_mkdb without causing a panic,
etc.

I'd be happy commit this if there is agreement.

-Brian
--
Brian Dean
bsd@FreeBSD.org
bsd@bsdhome.com


Index: rc.diskless1
===================================================================
RCS file: /home/ncvs/src/etc/rc.diskless1,v
retrieving revision 1.7
diff -u -r1.7 rc.diskless1
--- rc.diskless1	2001/04/03 00:24:01	1.7
+++ rc.diskless1	2001/04/20 15:08:16
@@ -87,39 +87,50 @@
     fi
 done
 echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
- 
-# Files in /etc are copied to /conf/etc which is writable. Then
-# per-machine configs from /conf/ip.address/etc are copied onto this
-# directory. First choice is using the client's IP, then the client's
-# broadcast address, then a default configuration.
+
+
+
+# Create an MFS /tmp to temporarily hold files from /etc until we
+# can bootstrap /etc as an MFS.
+
+/sbin/mount_mfs -s 4096 -T qp120at dummy /tmp
+chkerr $? "MFS mount on /tmp"
+mkdir /tmp/etc
+/bin/cp -Rp /etc /tmp
+chkerr $? "cp /etc to /tmp/etc MFS"
+
+/sbin/mount_mfs -s 4096 -T qp120at dummy /etc
+chkerr $? "MFS mount on /etc"
+/bin/chmod 755 /etc
+
+/bin/cp -Rp /tmp/etc/* /etc
+chkerr $? "cp /tmp/etc to /etc MFS"
+
+rm -rf /tmp/etc
+/sbin/umount /tmp
+
+
+# Allow for override files to replace files in /etc.  Use /conf/*/etc
+# to find the override files.  First choice is default files that
+# always override, then files that from the directory that matches the
+# client's broadcast address, finally followed by overrides that match
+# the client's IP address.
+#
 # This way we have some flexibility to handle clusters of machines
 # on separate subnets.
 #
-# WARNING! null mounts cannot handle mmap, and since many programs
-# use mmap (such as 'cp'), we have to copy.
-#
-mount_mfs -s 2048 -T qp120at dummy /conf/etc
-cp -Rp /etc/* /conf/etc
-chkerr $? "MFS mount on /conf/etc"
 
-# Pick up default, network-specific, and host-specific config, in that
-# order
-
 if [ -d /conf/default/etc/ ]; then
-	cp -Rp /conf/default/etc/* /conf/etc
+	cp -Rp /conf/default/etc/* /etc
 fi
 
 if [ -d /conf/${bootp_ipbca} ] ; then
-	cp -Rp /conf/${bootp_ipbca}/etc/* /conf/etc
+	cp -Rp /conf/${bootp_ipbca}/etc/* /etc
 fi
 
 if [ -d /conf/${bootp_ipa} ] ; then
-	cp -Rp /conf/${bootp_ipa}/etc/* /conf/etc
+	cp -Rp /conf/${bootp_ipa}/etc/* /etc
 fi
-
-# Make the new directory available as /etc
-#
-mount_null /conf/etc /etc
 
 # Tell /etc/rc to run the specified script after
 # it does its mounts but before it does anything

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




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