eventscripts: Might as well try to stat the reclock file first
authorMartin Schwenke <martin@meltin.net>
Tue, 30 Apr 2013 05:19:52 +0000 (15:19 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 6 May 2013 06:24:58 +0000 (16:24 +1000)
It is in the background but it still might cause the counter to be
reset before it is checked.

Signed-off-by: Martin Schwenke <martin@meltin.net>
config/events.d/01.reclock

index 676d475ff57fb1f17e79c902247c23b980f28a2d..0d8f7ba68796ec3ddf42085e726c6ed4ed094c2e 100755 (executable)
@@ -18,6 +18,15 @@ case "$1" in
        # Early exit if not using a reclock file
        [ -n "$RECLOCKFILE" ] || exit 0
 
+       # Try to stat the reclock file as a background process so that
+       # we don't block in case the cluster filesystem is unavailable
+       (
+           if stat $RECLOCKFILE ; then
+               # We could stat the file, reset the counter
+               ctdb_counter_init
+           fi
+       ) >/dev/null 2>&1 &
+
        ctdb_counter_incr
        (ctdb_check_counter_limit 200 >/dev/null 2>&1) || {
            echo "Reclock file $RECLOCKFILE\" can not be accessed. Shutting down."
@@ -26,15 +35,6 @@ case "$1" in
            ctdb shutdown
        }
 
-       # try stat the reclock file as a background process
-       # so that we dont block in case the cluster filesystem is unavailable
-       (
-           stat $RECLOCKFILE && {
-               # we could stat the file, reset the counter
-               ctdb_counter_init
-           }
-       ) >/dev/null 2>/dev/null &
-
        ctdb_check_counter_limit 3 quiet
        ;;