[Pkg-sysvinit-commits] r1834 - in sysvinit/trunk/debian: . src/initscripts/etc/init.d src/initscripts/lib/init

Petter Reinholdtsen pere at alioth.debian.org
Sat Mar 20 19:35:36 UTC 2010


Author: pere
Date: 2010-03-20 19:35:30 +0000 (Sat, 20 Mar 2010)
New Revision: 1834

Added:
   sysvinit/trunk/debian/src/initscripts/lib/init/swap-functions.sh
Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/src/initscripts/etc/init.d/checkfs.sh
   sysvinit/trunk/debian/src/initscripts/etc/init.d/mountall.sh
Log:
Enable swap earlier in the boot, to avoid running out of memory
during fsck (Closes: #552029).

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2010-03-20 10:10:42 UTC (rev 1833)
+++ sysvinit/trunk/debian/changelog	2010-03-20 19:35:30 UTC (rev 1834)
@@ -11,6 +11,8 @@
     #569032).
   * Make kernel argument parsing in /lib/init/vars.sh more robust to
     avoid incorrect matches (Closes: #557648).
+  * Enable swap earlier in the boot, to avoid running out of memory
+    during fsck (Closes: #552029).
 
  -- Petter Reinholdtsen <pere at debian.org>  Sun, 25 Oct 2009 22:32:18 +0100
 

Modified: sysvinit/trunk/debian/src/initscripts/etc/init.d/checkfs.sh
===================================================================
--- sysvinit/trunk/debian/src/initscripts/etc/init.d/checkfs.sh	2010-03-20 10:10:42 UTC (rev 1833)
+++ sysvinit/trunk/debian/src/initscripts/etc/init.d/checkfs.sh	2010-03-20 19:35:30 UTC (rev 1834)
@@ -20,6 +20,7 @@
 . /lib/lsb/init-functions
 . /lib/init/splash-functions-base
 . /lib/init/usplash-fsck-functions.sh
+. /lib/init/swap-functions.sh
 
 do_start () {
 	# See if we're on AC Power.  If not, we're not gonna run our
@@ -51,6 +52,11 @@
 	#
 	if [ "$fscheck" = yes ] && [ ! "$BAT" ] && [ "$FSCKTYPES" != "none" ]
 	then
+
+		# Execute swapon command again, in case there are lvm
+		# or md swap partitions.  fsck can suck RAM.
+		swaponagain 'lvm and md'
+
 		if [ -f /forcefsck ] || grep -s -w -i "forcefsck" /proc/cmdline
 		then
 			force="-f"

Modified: sysvinit/trunk/debian/src/initscripts/etc/init.d/mountall.sh
===================================================================
--- sysvinit/trunk/debian/src/initscripts/etc/init.d/mountall.sh	2010-03-20 10:10:42 UTC (rev 1833)
+++ sysvinit/trunk/debian/src/initscripts/etc/init.d/mountall.sh	2010-03-20 19:35:30 UTC (rev 1834)
@@ -14,6 +14,7 @@
 
 . /lib/lsb/init-functions
 . /lib/init/mount-functions.sh
+. /lib/init/swap-functions.sh
 
 # for ntfs-3g to get correct file name encoding
 if [ -r /etc/default/locale ]; then
@@ -62,27 +63,9 @@
 		kill -USR1 1
 	fi
 
-	#
 	# Execute swapon command again, in case we want to swap to
 	# a file on a now mounted filesystem.
-	#
-	# Ignore 255 status due to swap already being enabled
-	#
-	if [ "$NOSWAP" = yes ]
-	then
-		[ "$VERBOSE" = no ] || log_warning_msg "Not activating swap as requested via bootoption noswap."
-	else
-		if [ "$VERBOSE" = no ]
-		then
-			log_action_begin_msg "Activating swapfile swap"
-			swapon -a -e 2>/dev/null || :  # Stifle "Device or resource busy"
-			log_action_end_msg 0
-		else
-			log_daemon_msg "Will now activate swapfile swap"
-			swapon -a -e -v
-			log_action_end_msg $?
-		fi
-	fi
+	swaponagain 'swapfile'
 }
 
 case "$1" in

Added: sysvinit/trunk/debian/src/initscripts/lib/init/swap-functions.sh
===================================================================
--- sysvinit/trunk/debian/src/initscripts/lib/init/swap-functions.sh	                        (rev 0)
+++ sysvinit/trunk/debian/src/initscripts/lib/init/swap-functions.sh	2010-03-20 19:35:30 UTC (rev 1834)
@@ -0,0 +1,28 @@
+#
+# Functions that assist in turning on swap.
+#
+
+# $1 is a string used to log the type of swap expected to be activated
+swaponagain() {
+	#
+	# Execute swapon command again to pick up any swap partitions
+	# that have shown up since the last swapon.
+	#
+	# Ignore 255 status due to swap already being enabled
+	#
+	if [ "$NOSWAP" = yes ]
+	then
+		[ "$VERBOSE" = no ] || log_warning_msg "Not activating swap as requested via bootoption noswap."
+	else
+		if [ "$VERBOSE" = no ]
+		then
+			log_action_begin_msg "Activating $1 swap"
+			swapon -a -e 2>/dev/null || :  # Stifle "Device or resource busy"
+			log_action_end_msg 0
+		else
+			log_daemon_msg "Will now activate $1 swap"
+			swapon -a -e -v
+			log_action_end_msg $?
+		fi
+	fi
+}


Property changes on: sysvinit/trunk/debian/src/initscripts/lib/init/swap-functions.sh
___________________________________________________________________
Added: svn:executable
   + *




More information about the Pkg-sysvinit-commits mailing list