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

Petter Reinholdtsen pere at alioth.debian.org
Sun Mar 21 21:57:22 UTC 2010


Author: pere
Date: 2010-03-21 21:57:22 +0000 (Sun, 21 Mar 2010)
New Revision: 1850

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/src/initscripts/etc/init.d/umountfs
Log:
Adjust init.d/umountfs to avoid using -f when umounting devices
mounted before /, and avoid umounting file systems listed before /
in /proc/mounts to avoid hangs during shutdown.  Patch from Colin
Watson and Ubuntu.

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2010-03-21 20:27:29 UTC (rev 1849)
+++ sysvinit/trunk/debian/changelog	2010-03-21 21:57:22 UTC (rev 1850)
@@ -15,6 +15,10 @@
   * Change lsb-base depend for sysv-rc and initscripts from (>= 3.0-6) 
     to (>= 3.2-14) for the status_of_proc() function.  Patch from
     Dustin Kirkland and Ubuntu.
+  * Adjust init.d/umountfs to avoid using -f when umounting devices
+    mounted before /, and avoid umounting file systems listed before /
+    in /proc/mounts to avoid hangs during shutdown.  Patch from Colin
+    Watson and Ubuntu.
 
   [ Kel Modderman ]
   * Exit with value rather than echo the value for the status action in

Modified: sysvinit/trunk/debian/src/initscripts/etc/init.d/umountfs
===================================================================
--- sysvinit/trunk/debian/src/initscripts/etc/init.d/umountfs	2010-03-21 20:27:29 UTC (rev 1849)
+++ sysvinit/trunk/debian/src/initscripts/etc/init.d/umountfs	2010-03-21 21:57:22 UTC (rev 1850)
@@ -19,10 +19,13 @@
 do_stop () {
 	exec 9<&0 </proc/mounts
 
+	PROTECTED_MOUNTS="$(sed -n '0,/^\/[^ ]* \/ /p' /proc/mounts)"
+	WEAK_MTPTS="" # be gentle, don't use force
 	REG_MTPTS=""
 	TMPFS_MTPTS=""
 	while read -r DEV MTPT FSTYPE REST
 	do
+		echo "$PROTECTED_MOUNTS" | grep -qs "^$DEV $MTPT " && continue
 		case "$MTPT" in
 		  /|/proc|/dev|/.dev|/dev/pts|/dev/shm|/dev/.static/dev|/proc/*|/sys|/lib/init/rw)
 			continue
@@ -46,7 +49,11 @@
 			TMPFS_MTPTS="$MTPT $TMPFS_MTPTS"
 			;;
 		  *)
-			REG_MTPTS="$MTPT $REG_MTPTS"
+			if echo "$PROTECTED_MOUNTS" | grep -qs "^$DEV "; then
+				WEAK_MTPTS="$MTPT $WEAK_MTPTS"
+			else
+				REG_MTPTS="$MTPT $REG_MTPTS"
+			fi
 			;;
 		esac
 	done
@@ -89,6 +96,19 @@
 	#
 	# Unmount local filesystems
 	#
+	if [ "$WEAK_MTPTS" ]; then
+		# Do not use -f umount option for WEAK_MTPTS
+		if [ "$VERBOSE" = no ]
+		then
+			log_action_begin_msg "Unmounting weak filesystems"
+			fstab-decode umount -r -d $WEAK_MTPTS
+			log_action_end_msg $?
+		else
+			log_daemon_msg "Will now unmount weak filesystems"
+			fstab-decode umount -v -r -d $WEAK_MTPTS
+			log_end_msg $?
+		fi
+	fi
 	if [ "$REG_MTPTS" ]
 	then
 		if [ "$VERBOSE" = no ]




More information about the Pkg-sysvinit-commits mailing list