If two stop actions are ever performed simultaneously, then neither  
will terminate.
Without specifying a pidfile, the status() function from /etc/init.d/ 
functions incorrectly thinks the other stop action is a real corosync  
process.

Eg.

[r...@pcmk-1 ~]# ps axf | grep corosync
16664 pts/0    S      0:00  |       \_ /bin/bash /etc/init.d/corosync  
stop
16669 pts/0    S+     0:00  |       \_ /bin/bash /etc/init.d/corosync  
stop
16849 pts/1    S+     0:00          \_ grep corosync
[r...@pcmk-1 ~]# /etc/init.d/corosync status
corosync (pid 16669 16664) is running...
[r...@pcmk-1 ~]#


Index: init/generic.in
===================================================================
--- init/generic.in     (revision 2638)
+++ init/generic.in     (working copy)
@@ -23,6 +23,7 @@

  desc="Corosync Cluster Engine"
  prog="corosync"
+pidarg="-p @LOCALSTATEDIR@/run/$prog.pid"

  # set secure PATH
  PATH="/sbin:/bin:/usr/sbin:/usr/bin:@SBINDIR@"
@@ -72,14 +73,14 @@
        # required subdirectories for proper operations
        mkdir -p @LOCALSTATEDIR@/run

-       if status $prog > /dev/null 2>&1; then
+       if status $pidarg $prog > /dev/null 2>&1; then
                success
        else
                $prog > /dev/null 2>&1

                # give it time to fail
                sleep 2
-               if status $prog > /dev/null 2>&1; then
+               if status $pidarg $prog > /dev/null 2>&1; then
                        touch $LOCK_FILE
                        pidof $prog > @LOCALSTATEDIR@/run/$prog.pid
                        success
@@ -93,7 +94,7 @@

  stop()
  {
-       ! status $prog > /dev/null 2>&1 && return
+       ! status $pidarg $prog > /dev/null 2>&1 && return

        echo -n "Signaling $desc ($prog) to terminate: "
        kill -TERM $(pidof $prog) > /dev/null 2>&1
@@ -101,7 +102,7 @@
        echo

        echo -n "Waiting for $prog services to unload:"
-       while status $prog > /dev/null 2>&1; do
+       while status $pidarg $prog > /dev/null 2>&1; do
                sleep 1
                echo -n "."
        done
@@ -128,12 +129,12 @@
        restart
  ;;
  condrestart|try-restart)
-       if status $prog > /dev/null 2>&1; then
+       if status $pidarg $prog > /dev/null 2>&1; then
                restart
        fi
  ;;
  status)
-       status $prog
+       status $pidarg $prog
        rtrn=$?
  ;;
  stop)
:: svn : r2638 (Tue, 08 Dec 2009)

-- Andrew



_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to