[Pkg-glusterfs-devel] Bug#538877: glusterfs-server: initscript stop command kills client processes as well as the server process

John Leach john at johnleach.co.uk
Mon Jul 27 15:07:00 UTC 2009


Package: glusterfs-server
Version: 2.0.4-2
Severity: important
Tags: patch


When stopping the glusterd daemon, the initscript uses start-stop-daemon
with the "--exec" option which "Checks for processes that are instances 
of this executable".  Glusterfs uses the same binary for both server and
client processes, so if a machine has both processes running,
start-stop-daemon thinks the server process is still running.  The
initscript then goes on to kill the client process too.  Adding the
--name option fixes this.

The status initscript command relies on the same "--exec" option so
could misidentify the gluster client process as the server process
(unlikely but possible).  Adding a --name option fixes this too.
-------------- next part --------------
commit 07d4979536e5bd01b3a251c2d226d08942a91e49
Author: John Leach <john at johnleach.co.uk>
Date:   Mon Jul 27 15:57:52 2009 +0100

    Fix initscript stop and status functions. stop would kill client processes too and status could misidentify client processes as server processes.

diff --git a/debian/glusterfs-server.init b/debian/glusterfs-server.init
index 15df29d..58759f0 100755
--- a/debian/glusterfs-server.init
+++ b/debian/glusterfs-server.init
@@ -68,19 +68,7 @@ do_stop()
 	#   2 if daemon could not be stopped
 	#   other if a failure occurred
 	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
-	RETVAL="$?"
-	[ "$RETVAL" = 2 ] && return 2
-	# Wait for children to finish too if this is a daemon that forks
-	# and if the daemon is only ever run from this initscript.
-	# If the above conditions are not satisfied then add some other code
-	# that waits for the process to drop all resources that could be
-	# needed by services started subsequently.  A last resort is to
-	# sleep for some time.
-	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
-	[ "$?" = 2 ] && return 2
-	# Many daemons don't delete their pidfiles when they exit.
-	rm -f $PIDFILE
-	return "$RETVAL"
+	return $?
 }
 
 #
@@ -88,7 +76,7 @@ do_stop()
 #
 do_status()
 {
-	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null
+	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --name $NAME --test > /dev/null
 	RETVAL="$?"
 	if [ "$RETVAL" = 1 ]; then
             log_success_msg "$DESC is running."


More information about the Pkg-glusterfs-devel mailing list