Module Name:    src
Committed By:   joerg
Date:           Tue Apr 21 16:08:57 UTC 2009

Modified Files:
        src/distrib/sets/lists/etc: mi
        src/etc/mtree: special
        src/etc/rc.d: Makefile ccd cgd lvm mountcritlocal raidframe rndctl root
            swap1 wdogctl
        src/usr.sbin/postinstall: postinstall
Added Files:
        src/etc/rc.d: DISKS fsck_root

Log Message:
Split fsck during boot into two phases. Check the root file system
first, mount root and run the various disk providers. Add swap and
check the remaining file systems after that.
This breaks the dependency cycle for lvm, which needs writeable /dev.
Depend on rndctl in cgd.


To generate a diff of this commit:
cvs rdiff -u -r1.207 -r1.208 src/distrib/sets/lists/etc/mi
cvs rdiff -u -r1.127 -r1.128 src/etc/mtree/special
cvs rdiff -u -r0 -r1.1 src/etc/rc.d/DISKS src/etc/rc.d/fsck_root
cvs rdiff -u -r1.76 -r1.77 src/etc/rc.d/Makefile
cvs rdiff -u -r1.5 -r1.6 src/etc/rc.d/ccd src/etc/rc.d/cgd
cvs rdiff -u -r1.4 -r1.5 src/etc/rc.d/lvm
cvs rdiff -u -r1.9 -r1.10 src/etc/rc.d/mountcritlocal src/etc/rc.d/raidframe \
    src/etc/rc.d/swap1
cvs rdiff -u -r1.2 -r1.3 src/etc/rc.d/rndctl
cvs rdiff -u -r1.3 -r1.4 src/etc/rc.d/root src/etc/rc.d/wdogctl
cvs rdiff -u -r1.93 -r1.94 src/usr.sbin/postinstall/postinstall

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/etc/mi
diff -u src/distrib/sets/lists/etc/mi:1.207 src/distrib/sets/lists/etc/mi:1.208
--- src/distrib/sets/lists/etc/mi:1.207	Mon Feb  2 20:47:20 2009
+++ src/distrib/sets/lists/etc/mi	Tue Apr 21 16:08:57 2009
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.207 2009/02/02 20:47:20 joerg Exp $
+# $NetBSD: mi,v 1.208 2009/04/21 16:08:57 joerg Exp $
 #
 # Note: end-user configuration files that are moved to another location
 #	should not be marked "obsolete"; they should just be removed from
@@ -159,6 +159,7 @@
 ./etc/rc					etc-sys-rc
 ./etc/rc.conf					etc-sys-rc
 ./etc/rc.d/DAEMON				etc-sys-rc
+./etc/rc.d/DISKS				etc-sys-rc
 ./etc/rc.d/LOGIN				etc-sys-rc
 ./etc/rc.d/NETWORK				etc-obsolete		obsolete
 ./etc/rc.d/NETWORKING				etc-sys-rc
@@ -187,6 +188,7 @@
 ./etc/rc.d/envsys				etc-sys-rc
 ./etc/rc.d/fixsb				etc-obsolete		obsolete
 ./etc/rc.d/fsck					etc-sys-rc
+./etc/rc.d/fsck_root				etc-sys-rc
 ./etc/rc.d/fsck.sh				etc-obsolete		obsolete
 ./etc/rc.d/ftp_proxy				etc-net-rc
 ./etc/rc.d/ftpd					etc-net-rc

Index: src/etc/mtree/special
diff -u src/etc/mtree/special:1.127 src/etc/mtree/special:1.128
--- src/etc/mtree/special:1.127	Sun Jan 18 08:24:46 2009
+++ src/etc/mtree/special	Tue Apr 21 16:08:57 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: special,v 1.127 2009/01/18 08:24:46 taca Exp $
+#	$NetBSD: special,v 1.128 2009/04/21 16:08:57 joerg Exp $
 #	@(#)special	8.2 (Berkeley) 1/23/94
 #
 # This file may be overwritten on upgrades.
@@ -178,6 +178,7 @@
 ./etc/rc.conf			type=file mode=0644
 ./etc/rc.d			type=dir  mode=0755
 ./etc/rc.d/DAEMON		type=file mode=0555
+./etc/rc.d/DISKS		type=file mode=0555
 ./etc/rc.d/LOGIN		type=file mode=0555
 ./etc/rc.d/NETWORKING		type=file mode=0555
 ./etc/rc.d/SERVERS		type=file mode=0555
@@ -202,6 +203,7 @@
 ./etc/rc.d/downinterfaces	type=file mode=0555
 ./etc/rc.d/envsys		type=file mode=0555
 ./etc/rc.d/fsck			type=file mode=0555
+./etc/rc.d/fsck_root		type=file mode=0555
 ./etc/rc.d/ftp_proxy		type=file mode=0555
 ./etc/rc.d/ftpd			type=file mode=0555
 ./etc/rc.d/hostapd		type=file mode=0555

Index: src/etc/rc.d/Makefile
diff -u src/etc/rc.d/Makefile:1.76 src/etc/rc.d/Makefile:1.77
--- src/etc/rc.d/Makefile:1.76	Wed Apr 15 22:36:04 2009
+++ src/etc/rc.d/Makefile	Tue Apr 21 16:08:57 2009
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.76 2009/04/15 22:36:04 joerg Exp $
+# $NetBSD: Makefile,v 1.77 2009/04/21 16:08:57 joerg Exp $
 
 .include <bsd.own.mk>
 
@@ -14,12 +14,12 @@
 # src/sbin/rcorder.
 
 CONFIGFILES=\
-		DAEMON LOGIN NETWORKING SERVERS \
+		DAEMON DISKS LOGIN NETWORKING SERVERS \
 		accounting altqd amd apmd \
 		bootconf.sh bootparams btattach btconfig btdevctl bthcid \
 		ccd cgd cleartmp cron \
 		dhclient dhcpd dhcrelay dmesg downinterfaces envsys \
-		fsck ftp_proxy ftpd \
+		fsck fsck_root ftp_proxy ftpd \
 		hostapd httpd \
 		identd ifwatchd inetd ipfilter ipfs ipmon ipnat ipsec \
 		irdaattach iscsi_target isdnd \

Index: src/etc/rc.d/ccd
diff -u src/etc/rc.d/ccd:1.5 src/etc/rc.d/ccd:1.6
--- src/etc/rc.d/ccd:1.5	Fri Aug 13 18:08:03 2004
+++ src/etc/rc.d/ccd	Tue Apr 21 16:08:57 2009
@@ -1,9 +1,10 @@
 #!/bin/sh
 #
-# $NetBSD: ccd,v 1.5 2004/08/13 18:08:03 mycroft Exp $
+# $NetBSD: ccd,v 1.6 2009/04/21 16:08:57 joerg Exp $
 #
 
-# PROVIDE: disks
+# PROVIDE: ccd
+# BEFORE:  DISKS
 
 $_rc_subr_loaded . /etc/rc.subr
 
Index: src/etc/rc.d/cgd
diff -u src/etc/rc.d/cgd:1.5 src/etc/rc.d/cgd:1.6
--- src/etc/rc.d/cgd:1.5	Wed Mar  2 19:09:22 2005
+++ src/etc/rc.d/cgd	Tue Apr 21 16:08:57 2009
@@ -1,9 +1,11 @@
 #!/bin/sh
 #
-# $NetBSD: cgd,v 1.5 2005/03/02 19:09:22 tv Exp $
+# $NetBSD: cgd,v 1.6 2009/04/21 16:08:57 joerg Exp $
 #
 
-# PROVIDE: disks
+# PROVIDE: cgd
+# REQUIRE: rndctl
+# BEFORE:  DISKS
 
 $_rc_subr_loaded . /etc/rc.subr
 

Index: src/etc/rc.d/lvm
diff -u src/etc/rc.d/lvm:1.4 src/etc/rc.d/lvm:1.5
--- src/etc/rc.d/lvm:1.4	Mon Apr 13 18:48:14 2009
+++ src/etc/rc.d/lvm	Tue Apr 21 16:08:57 2009
@@ -1,10 +1,11 @@
 #!/bin/sh
 #
-# $NetBSD: lvm,v 1.4 2009/04/13 18:48:14 haad Exp $
+# $NetBSD: lvm,v 1.5 2009/04/21 16:08:57 joerg Exp $
 #
 
-# PROVIDE: disks
+# PROVIDE: lvm
 # REQUIRE: root
+# BEFORE:  DISKS
 
 $_rc_subr_loaded . /etc/rc.subr
 

Index: src/etc/rc.d/mountcritlocal
diff -u src/etc/rc.d/mountcritlocal:1.9 src/etc/rc.d/mountcritlocal:1.10
--- src/etc/rc.d/mountcritlocal:1.9	Sun Nov 12 01:22:58 2006
+++ src/etc/rc.d/mountcritlocal	Tue Apr 21 16:08:57 2009
@@ -1,10 +1,10 @@
 #!/bin/sh
 #
-# $NetBSD: mountcritlocal,v 1.9 2006/11/12 01:22:58 christos Exp $
+# $NetBSD: mountcritlocal,v 1.10 2009/04/21 16:08:57 joerg Exp $
 #
 
 # PROVIDE: mountcritlocal
-# REQUIRE: root
+# REQUIRE: fsck
 
 $_rc_subr_loaded . /etc/rc.subr
 
Index: src/etc/rc.d/raidframe
diff -u src/etc/rc.d/raidframe:1.9 src/etc/rc.d/raidframe:1.10
--- src/etc/rc.d/raidframe:1.9	Fri Aug 13 18:08:03 2004
+++ src/etc/rc.d/raidframe	Tue Apr 21 16:08:57 2009
@@ -1,9 +1,10 @@
 #!/bin/sh
 #
-# $NetBSD: raidframe,v 1.9 2004/08/13 18:08:03 mycroft Exp $
+# $NetBSD: raidframe,v 1.10 2009/04/21 16:08:57 joerg Exp $
 #
 
-# PROVIDE: disks
+# PROVIDE: raidframe
+# BEFORE:  DISKS
 
 $_rc_subr_loaded . /etc/rc.subr
 
Index: src/etc/rc.d/swap1
diff -u src/etc/rc.d/swap1:1.9 src/etc/rc.d/swap1:1.10
--- src/etc/rc.d/swap1:1.9	Fri Aug 13 18:08:03 2004
+++ src/etc/rc.d/swap1	Tue Apr 21 16:08:57 2009
@@ -1,10 +1,10 @@
 #!/bin/sh
 #
-# $NetBSD: swap1,v 1.9 2004/08/13 18:08:03 mycroft Exp $
+# $NetBSD: swap1,v 1.10 2009/04/21 16:08:57 joerg Exp $
 #
 
 # PROVIDE: localswap
-# REQUIRE: disks
+# REQUIRE: DISKS root
 # KEYWORD: shutdown
 
 $_rc_subr_loaded . /etc/rc.subr

Index: src/etc/rc.d/rndctl
diff -u src/etc/rc.d/rndctl:1.2 src/etc/rc.d/rndctl:1.3
--- src/etc/rc.d/rndctl:1.2	Mon Feb  2 09:24:47 2009
+++ src/etc/rc.d/rndctl	Tue Apr 21 16:08:57 2009
@@ -1,10 +1,11 @@
 #!/bin/sh
 #
-# $NetBSD: rndctl,v 1.2 2009/02/02 09:24:47 apb Exp $
+# $NetBSD: rndctl,v 1.3 2009/04/21 16:08:57 joerg Exp $
 #
 
 # PROVIDE: rndctl
-# BEFORE: disks ike ipsec sshd
+# BEFORE:  DISKS ike ipsec sshd
+# REQUIRE: wdogctl
 
 $_rc_subr_loaded . /etc/rc.subr
 

Index: src/etc/rc.d/root
diff -u src/etc/rc.d/root:1.3 src/etc/rc.d/root:1.4
--- src/etc/rc.d/root:1.3	Fri Aug 13 18:08:03 2004
+++ src/etc/rc.d/root	Tue Apr 21 16:08:57 2009
@@ -1,10 +1,10 @@
 #!/bin/sh
 #
-# $NetBSD: root,v 1.3 2004/08/13 18:08:03 mycroft Exp $
+# $NetBSD: root,v 1.4 2009/04/21 16:08:57 joerg Exp $
 #
 
 # PROVIDE: root
-# REQUIRE: fsck
+# REQUIRE: fsck_root
 
 $_rc_subr_loaded . /etc/rc.subr
 
Index: src/etc/rc.d/wdogctl
diff -u src/etc/rc.d/wdogctl:1.3 src/etc/rc.d/wdogctl:1.4
--- src/etc/rc.d/wdogctl:1.3	Wed Apr 15 21:33:57 2009
+++ src/etc/rc.d/wdogctl	Tue Apr 21 16:08:57 2009
@@ -1,10 +1,10 @@
 #!/bin/sh
 #
-# $NetBSD: wdogctl,v 1.3 2009/04/15 21:33:57 joerg Exp $
+# $NetBSD: wdogctl,v 1.4 2009/04/21 16:08:57 joerg Exp $
 #
 
 # PROVIDE: wdogctl
-# BEFORE:  disks
+# BEFORE:  fsck_root
 
 # The watchdog is configured VERY early, so that any problems that
 # occur during the bootstrap process are protected by the watchdog.

Index: src/usr.sbin/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.93 src/usr.sbin/postinstall/postinstall:1.94
--- src/usr.sbin/postinstall/postinstall:1.93	Mon Apr  6 00:30:33 2009
+++ src/usr.sbin/postinstall/postinstall	Tue Apr 21 16:08:57 2009
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.93 2009/04/06 00:30:33 martin Exp $
+# $NetBSD: postinstall,v 1.94 2009/04/21 16:08:57 joerg Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -991,12 +991,12 @@
 	fi
 
 	compare_dir "${op}" "${SRC_DIR}/etc/rc.d" "${DEST_DIR}/etc/rc.d" 555 \
-		DAEMON LOGIN NETWORKING SERVERS \
+		DAEMON DISKS LOGIN NETWORKING SERVERS \
 		accounting altqd amd apmd \
 		bootconf.sh bootparams btattach btconfig btdevctl bthcid \
 		ccd cgd cleartmp cron \
 		dhclient dhcpd dhcrelay dmesg downinterfaces envsys \
-		fsck ftp_proxy ftpd \
+		fsck fsck_root ftp_proxy ftpd \
 		hostapd httpd \
 		identd ifwatchd inetd ipfilter ipfs ipmon ipnat ipsec \
 		irdaattach iscsi_target isdnd \

Added files:

Index: src/etc/rc.d/DISKS
diff -u /dev/null src/etc/rc.d/DISKS:1.1
--- /dev/null	Tue Apr 21 16:08:57 2009
+++ src/etc/rc.d/DISKS	Tue Apr 21 16:08:57 2009
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $NetBSD: DISKS,v 1.1 2009/04/21 16:08:57 joerg Exp $
+#
+
+# PROVIDE: DISKS
+
+#
+# This is a dummy dependency, to ensure that all disk devices are
+# accessible for fsck and mountcritlocal.
+#
Index: src/etc/rc.d/fsck_root
diff -u /dev/null src/etc/rc.d/fsck_root:1.1
--- /dev/null	Tue Apr 21 16:08:57 2009
+++ src/etc/rc.d/fsck_root	Tue Apr 21 16:08:57 2009
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# $NetBSD: fsck_root,v 1.1 2009/04/21 16:08:57 joerg Exp $
+#
+
+# PROVIDE: fsck_root
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="fsck_root"
+start_cmd="fsck_root_start"
+stop_cmd=":"
+
+fsck_root_start()
+{
+	if [ -e /fastboot ]; then
+		echo "Fast boot: skipping disk checks."
+		return
+	fi
+	trap : 2 		# Ignore SIGINT, SIGQUIT, so we
+	trap : 3		# enter single-user mode on failure.
+
+	echo "Starting root file system check:"
+	fsck $fsck_flags /
+	local fsck_error="$?"
+	case $fsck_error in
+	0)	# OK
+		return
+		;;
+	2)	# Needs re-run, still fs errors
+		echo "file system still has errors; re-run fsck manually!"
+		;;
+	4)	# Root modified
+		echo "Root filesystem was modified, rebooting ..."
+		reboot
+		echo "Reboot failed; help!"
+		;;
+	8)	# Check failed
+		echo "Automatic file system check failed; help!"
+		;;
+	12)	# Got signal
+		echo "Boot interrupted."
+		;;
+	*)
+		echo "Unknown error $fsck_error; help!"
+		;;
+	esac
+	stop_boot
+}
+
+load_rc_config $name
+run_rc_command "$1"

Reply via email to