[Pkg-sysvinit-devel] Bug#391375: initscripts: umountnfs.sh: shutdown fails in presence of bind-mounts

Petter Reinholdtsen pere at hungry.com
Sat Oct 21 10:54:56 CEST 2006


[Gabor Gombas]
> After the latest sysvinit/initscripts upgrades shutdown seems to be
> broken. This machine has (among other things) /sys and /dev/pts
> bind-mounted in a chroot.

Can you test this patch and see if it solve the problem?

Index: debian/initscripts/etc/init.d/umountnfs.sh
===================================================================
--- debian/initscripts/etc/init.d/umountnfs.sh	(revision 1017)
+++ debian/initscripts/etc/init.d/umountnfs.sh	(working copy)
@@ -65,14 +65,19 @@
 		case "$FSTYPE" in
 		  nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs)
 			DIRS="$MTPT $DIRS"
+			KILLDIRS="$MTPT $KILLDIRS"
 			;;
 		  proc|procfs|linprocfs|devfs|devpts|usbfs|usbdevfs|sysfs)
 			DIRS="$MTPT $DIRS"
+			# Avoid to kill processes using virtual file
+			# systems in subdirectories, as they might be
+			# bind-mounted to the toplevel mount points.
 			;;
 		esac
 		case "$OPTS" in
 		  _netdev|*,_netdev|_netdev,*|*,_netdev,*)
 			DIRS="$MTPT $DIRS"
+			KILLDIRS="$MTPT $KILLDIRS"
 			;;
 		esac
 	done
@@ -81,22 +86,25 @@
 
 	if [ "$DIRS" ]
 	then
-		# Kill all processes using the directories we try to umount
+		# Kill all processes using the directories with
+		# non-virtual file systems we try to umount
 		if [ -x /bin/fuser ] ; then
+		    if [ "$KILLDIRS" ] ; then
 			[ "$VERBOSE" = no ] || log_action_begin_msg "Asking non-system processes to terminate"
-			fuser -s -k -INT -m $DIRS
+			fuser -s -k -INT -m $KILLDIRS
 			[ "$VERBOSE" = no ] || log_action_end_msg 0
 
 			for count in 1 2 3 4 5; do # Wait up to 5 seconds
 			    sleep 1
-			    fuser -s -m $DIRS || break
+			    fuser -s -m $KILLDIRS || break
 			done
 
-			if fuser -s -m $DIRS; then
+			if fuser -s -m $KILLDIRS; then
 			    [ "$VERBOSE" = no ] || log_action_begin_msg "Killing non-system processes"
-			    fuser -s -k -TERM -m $DIRS
+			    fuser -s -k -TERM -m $KILLDIRS
 			    [ "$VERBOSE" = no ] || log_action_end_msg 0
 			fi
+		    fi
 		else
 		    log_warning_msg "Missing fuser, using sendsigs to kill all programs"
 		    log_warning_msg "Install psmisc if you want to kill only processes"




More information about the Pkg-sysvinit-devel mailing list