[Pkg-sysvinit-devel] Bug#258420: Avoid killing network-related services before umounting remove file systems

Petter Reinholdtsen pere at hungry.com
Mon Sep 11 07:48:27 UTC 2006


I would like to implement the following fix for the problem with
network services being killed before remote file systems are taken
down.  Can you test it, and let me know if it work for you?

Index: debian/changelog
===================================================================
--- debian/changelog	(revisjon 906)
+++ debian/changelog	(arbeidskopi)
@@ -3,6 +3,11 @@
   * Correct status report handling in umountnfs.sh.  Based on patch
     from Markus Schoder. (Closes: #386893)
 
+  * Only kill processes using remote file systems before trying to
+    umount them, if fuser from the psmisc package is available, and
+    move sendsigs to a point between where remote and local file systems
+    are umounted.  Recommend psmisc.  (Closes: #258420, #367944)
+
  -- Petter Reinholdtsen <pere at debian.org>  Mon, 11 Sep 2006 00:44:44 +0200
 
 sysvinit (2.86.ds1-20) unstable; urgency=low
Index: debian/control
===================================================================
--- debian/control	(revisjon 881)
+++ debian/control	(arbeidskopi)
@@ -36,6 +36,7 @@
 Package: initscripts
 Architecture: any
 Depends: ${shlibs:Depends}, ${glibc:Depends}, ${mount:Depends}, e2fsprogs (>= 1.32+1.33-WIP-2003.04.14-1), debianutils (>= 2.13.1), lsb-base (>= 3.0-6)
+Recommends: psmisc
 Conflicts: mdutils, sysv-rc (<< 2.86.ds1-1.2), sysvinit (<< 2.86.ds1-12)
 Replaces: mdutils, sysvinit (<< 2.85-12), libc6, libc6.1, libc0.1, libc0.3
 Description: Scripts for initializing and shutting down the system
Index: debian/initscripts/postinst
===================================================================
--- debian/initscripts/postinst	(revisjon 900)
+++ debian/initscripts/postinst	(arbeidskopi)
@@ -93,6 +93,12 @@
 	update-rc.d -f hostname.sh remove >/dev/null 2>&1 || :
 fi
 
+# In 2.86.ds1-21, the sendsigs script were moved.
+if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-21"
+then
+	update-rc.d -f sendsigs remove >/dev/null 2>&1 || :
+fi
+
 #
 # Okay, we could do this with update-rc.d, but that would probably
 # be pretty slow. This way we win some speed.
@@ -122,8 +128,8 @@
 updatercd reboot                 start 90 6 .
 updatercd umountroot             start 60 0 6 .
 updatercd umountfs               start 40 0 6 .
+updatercd sendsigs               start 37 0 6 .
 updatercd umountnfs.sh           start 31 0 6 .
-updatercd sendsigs               start 20 0 6 .
 
 updatercd killprocs              start 30 1 .
 updatercd single                 start 90 1 .
Index: debian/initscripts/etc/init.d/umountnfs.sh
===================================================================
--- debian/initscripts/etc/init.d/umountnfs.sh	(revisjon 907)
+++ debian/initscripts/etc/init.d/umountnfs.sh	(arbeidskopi)
@@ -71,6 +71,25 @@
 
 	if [ "$DIRS" ]
 	then
+		# Kill all processes using the directories we try to umount
+		if [ -x /bin/fuser ] ; then
+			[ "$VERBOSE" = no ] || log_action_begin_msg "Asking non-system processes to terminate"
+			fuser -k INT -m $DIRS
+			[ "$VERBOSE" = no ] || log_action_end_msg 0
+
+			for count in 1 2 3 4 5; do # Wait up to 5 seconds
+			    sleep 1
+			    [ -z "`fuser -m $DIRS 2> /dev/null`" ] && break
+			done
+
+			pidsleft=`fuser -m $DIRS 2>/dev/null`
+			if [ "$pidsleft" ] ; then
+			    [ "$VERBOSE" = no ] || log_action_begin_msg "Killing non-system processes"
+			    fuser -k TERM -m $DIRS
+			    [ "$VERBOSE" = no ] || log_action_end_msg 0
+			fi
+		fi
+
 		[ "$VERBOSE" = no ] || log_action_begin_msg "Unmounting remote and non-toplevel virtual filesystems"
 		umount $FLAGS $DIRS
 		ES=$?




More information about the Pkg-sysvinit-devel mailing list