1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

ctdb/eventscripts: Reconfigure lock should be released quickly

Currently the lock is held until the corresponding eventscript
completes, since the process still exists.  If the regular part of an
eventscript hangs then the lock might unnecessarily be held for a long
time.  The pathological case is when a monitor event gets stuck in
D-wait state and the script times out but can't be killed so the lock
is still held.  This can cause an unwanted monitor replay.

Change this so that the lock is released immediately after the
reconfiguration is complete.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2013-12-18 13:51:22 +11:00 committed by Amitay Isaacs
parent e77d5f99e3
commit 8eb20c2347
4 changed files with 15 additions and 5 deletions

View File

@ -1106,7 +1106,7 @@ service_reconfigure ()
:
}
ctdb_reconfigure_try_lock ()
ctdb_reconfigure_take_lock ()
{
_ctdb_service_reconfigure_common
_lock="${_d}/reconfigure_lock"
@ -1133,6 +1133,14 @@ ctdb_reconfigure_try_lock ()
) <"$_lock"
}
ctdb_reconfigure_release_lock ()
{
_ctdb_service_reconfigure_common
_lock="${_d}/reconfigure_lock"
rm -f "$_lock"
}
ctdb_replay_monitor_status ()
{
echo "Replaying previous status for this script due to reconfigure..."
@ -1182,7 +1190,7 @@ ctdb_service_check_reconfigure ()
*) return 0 ;;
esac
if ctdb_reconfigure_try_lock ; then
if ctdb_reconfigure_take_lock ; then
# No events covered by this function are running, so proceed
# with gay abandon.
case "$event_name" in
@ -1196,6 +1204,8 @@ ctdb_service_check_reconfigure ()
fi
;;
esac
ctdb_reconfigure_release_lock
else
# Somebody else is running an event we don't want to collide
# with. We proceed with caution.

View File

@ -16,7 +16,7 @@ simple_test_event "takeip" $public_address
ctdb_fake_scriptstatus 1 "ERROR" "$err"
eventscript_call ctdb_reconfigure_try_lock
eventscript_call ctdb_reconfigure_take_lock
required_result 1 <<EOF
Replaying previous status for this script due to reconfigure...

View File

@ -16,7 +16,7 @@ simple_test_event "takeip" $public_address
ctdb_fake_scriptstatus -62 "TIMEDOUT" "$err"
eventscript_call ctdb_reconfigure_try_lock
eventscript_call ctdb_reconfigure_take_lock
required_result 1 <<EOF
Replaying previous status for this script due to reconfigure...

View File

@ -16,7 +16,7 @@ simple_test_event "takeip" $public_address
ctdb_fake_scriptstatus -8 "DISABLED" "$err"
eventscript_call ctdb_reconfigure_try_lock
eventscript_call ctdb_reconfigure_take_lock
ok <<EOF
Replaying previous status for this script due to reconfigure...