And now with a functional patch.
The important part was not to use status_args everywhere, but only for
key calls to status()

On Mon, Dec 14, 2009 at 1:07 PM, Andrew Beekhof <[email protected]> wrote:
> Ignore this patch, it's far too reliant on the existence of a pidfile.
> If one doesn't exist then it can't shutdown the cluster.
>
> On Mon, Dec 14, 2009 at 12:54 PM, Andrew Beekhof <[email protected]> wrote:
>> 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"
+pid_fi...@localstatedir@/run/$prog.pid

 # set secure PATH
 PATH="/sbin:/bin:/usr/sbin:/usr/bin:@SBINDIR@"
@@ -62,6 +63,8 @@
        [ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/$prog"
 fi

+status_args="-p $PID_FILE -l $LOCK_FILE"
+
 start()
 {
        echo -n "Starting $desc ($prog): "
@@ -72,7 +75,7 @@
        # required subdirectories for proper operations
        mkdir -p @LOCALSTATEDIR@/run

-       if status $prog > /dev/null 2>&1; then
+       if status $status_args $prog > /dev/null 2>&1; then
                success
        else
                $prog > /dev/null 2>&1
@@ -81,7 +84,7 @@
                sleep 2
                if status $prog > /dev/null 2>&1; then
                        touch $LOCK_FILE
-                       pidof $prog > @LOCALSTATEDIR@/run/$prog.pid
+                       pidof $prog > $PID_FILE
                        success
                else
                        failure
@@ -101,13 +104,13 @@
        echo

        echo -n "Waiting for $prog services to unload:"
-       while status $prog > /dev/null 2>&1; do
+       while status $status_args $prog > /dev/null 2>&1; do
                sleep 1
                echo -n "."
        done

        rm -f $LOCK_FILE
-       rm -f @LOCALSTATEDIR@/run/$prog.pid
+       rm -f $PID_FILE
        success
        echo
 }
@@ -133,7 +136,7 @@
        fi
 ;;
 status)
-       status $prog
+       status $status_args $prog
        rtrn=$?
 ;;
 stop)
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to