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

Elimar Riesebieter riesebie at lxtec.de
Mon Sep 11 13:32:11 UTC 2006


On Mon, 11 Sep 2006 the mental interface of
Petter Reinholdtsen told:

> 
> 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?

Works perfect on my ppc.
[...]
> 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)
[...]
>  		ES=$?
         ^^^^^
Patched against 2.86.ds1-20 has a fuzz. Please see attached patch. I
completed initsripts/lintian.overwrites with three additional
notes.

Thanks
Elimar

-- 
  It's a good thing we don't get all 
  the government we pay for.
-------------- next part --------------
diff -urNad sysvinit-2.86.ds1~/debian/changelog sysvinit-2.86.ds1/debian/changelog
--- sysvinit-2.86.ds1~/debian/changelog	2006-09-11 14:50:23.000000000 +0200
+++ sysvinit-2.86.ds1/debian/changelog	2006-09-11 15:10:40.000000000 +0200
@@ -1,3 +1,12 @@
+sysvinit (2.86.ds1-21) unstable; urgency=low
+
+  * 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
 
   * Change initscripts postinst to use update-rc.d program instead of
diff -urNad sysvinit-2.86.ds1~/debian/control sysvinit-2.86.ds1/debian/control
--- sysvinit-2.86.ds1~/debian/control	2006-09-11 14:50:23.000000000 +0200
+++ sysvinit-2.86.ds1/debian/control	2006-09-11 15:10:40.000000000 +0200
@@ -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
diff -urNad sysvinit-2.86.ds1~/debian/initscripts/etc/init.d/umountnfs.sh sysvinit-2.86.ds1/debian/initscripts/etc/init.d/umountnfs.sh
--- sysvinit-2.86.ds1~/debian/initscripts/etc/init.d/umountnfs.sh	2006-09-11 14:50:23.000000000 +0200
+++ sysvinit-2.86.ds1/debian/initscripts/etc/init.d/umountnfs.sh	2006-09-11 15:10:40.000000000 +0200
@@ -70,6 +70,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
 		[ "$VERBOSE" = no ] || log_action_end_msg $?
diff -urNad sysvinit-2.86.ds1~/debian/initscripts/lintian.overrides sysvinit-2.86.ds1/debian/initscripts/lintian.overrides
--- sysvinit-2.86.ds1~/debian/initscripts/lintian.overrides	2006-09-11 14:50:23.000000000 +0200
+++ sysvinit-2.86.ds1/debian/initscripts/lintian.overrides	2006-09-11 15:21:53.000000000 +0200
@@ -1,3 +1,6 @@
 initscripts: script-in-etc-init.d-not-registered-via-update-rc.d
 initscripts: file-in-etc-not-marked-as-conffile /etc/init.d/skeleton
 initscripts: non-standard-toplevel-dir sys/
+initscripts: non-standard-file-permissions-for-etc-init.d-script etc/init.d/skeleton 0644 != 0755
+initscripts: script-not-executable ./etc/init.d/skeleton
+initscripts: maintainer-script-calls-init-script-directly postrm:14
diff -urNad sysvinit-2.86.ds1~/debian/initscripts/postinst sysvinit-2.86.ds1/debian/initscripts/postinst
--- sysvinit-2.86.ds1~/debian/initscripts/postinst	2006-09-11 14:50:23.000000000 +0200
+++ sysvinit-2.86.ds1/debian/initscripts/postinst	2006-09-11 15:10:40.000000000 +0200
@@ -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 .


More information about the Pkg-sysvinit-devel mailing list