diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2010-04-08 15:11:05 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-04-08 15:11:05 +0930 |
commit | 6da848f31ca301a1439053ad9d58b19d2ea3f6b4 (patch) | |
tree | 3a4416598c969ef83f7c24d8960b32ee4503a22a /ctdb | |
parent | a9c8b9e89b9bc1affc11db9c84b0a2bc079331d3 (diff) | |
download | samba-6da848f31ca301a1439053ad9d58b19d2ea3f6b4.tar.gz samba-6da848f31ca301a1439053ad9d58b19d2ea3f6b4.tar.xz samba-6da848f31ca301a1439053ad9d58b19d2ea3f6b4.zip |
eventscript: simplify script timeout handling
Now the script child signal handler doesn't do anything, we can unify the
"timeout" and "abort" cases introduced in 9dd25cb751919799.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(This used to be ctdb commit 439f049c7024d69aa4b87dc811e1772981ad29cb)
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/server/eventscript.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c index 2691d8f6ec..8011269e26 100644 --- a/ctdb/server/eventscript.c +++ b/ctdb/server/eventscript.c @@ -30,7 +30,7 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_event *te, struct timeval t, void *p); /* - ctdbd sends us a SIGTERM when we should time out the current script + ctdbd sends us a SIGTERM when we should die. */ static void sigterm(int sig) { @@ -39,17 +39,6 @@ static void sigterm(int sig) _exit(1); } -/* - ctdbd sends us a SIGABRT when we should abort the current script. - we abort any active monitor script any time a different event is generated. - */ -static void sigabrt(int sig) -{ - /* all the child processes will be running in the same process group */ - kill(-getpgrp(), SIGKILL); - _exit(1); -} - struct ctdb_event_script_state { struct ctdb_context *ctdb; pid_t child; @@ -58,7 +47,6 @@ struct ctdb_event_script_state { int fd[2]; void *private_data; bool from_user; - bool aborted; enum ctdb_eventscript_call call; const char *options; struct timeval timeout; @@ -271,7 +259,6 @@ static int child_setup(struct ctdb_context *ctdb) } signal(SIGTERM, sigterm); - signal(SIGABRT, sigabrt); return 0; } @@ -575,17 +562,10 @@ static int event_script_destructor(struct ctdb_event_script_state *state) int status; if (state->child) { - if (state->aborted != True) { - DEBUG(DEBUG_ERR,(__location__ " Sending SIGTERM to child pid:%d\n", state->child)); + DEBUG(DEBUG_ERR,(__location__ " Sending SIGTERM to child pid:%d\n", state->child)); - if (kill(state->child, SIGTERM) != 0) { - DEBUG(DEBUG_ERR,("Failed to kill child process for eventscript, errno %s(%d)\n", strerror(errno), errno)); - } - } else { - DEBUG(DEBUG_INFO,(__location__ " Sending SIGABRT to script child pid:%d\n", state->child)); - if (kill(state->child, SIGABRT) != 0) { - DEBUG(DEBUG_ERR,("Failed to kill child process for eventscript, errno %s(%d)\n", strerror(errno), errno)); - } + if (kill(state->child, SIGTERM) != 0) { + DEBUG(DEBUG_ERR,("Failed to kill child process for eventscript, errno %s(%d)\n", strerror(errno), errno)); } } @@ -682,7 +662,6 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb, state->callback = callback; state->private_data = private_data; state->from_user = from_user; - state->aborted = False; state->call = call; state->options = talloc_vasprintf(state, fmt, ap); state->timeout = timeval_set(ctdb->tunable.script_timeout, 0); @@ -725,7 +704,6 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb, /* Kill off any running monitor events to run this event. */ if (ctdb->current_monitor) { /* Discard script status so we don't save to last_status */ - ctdb->current_monitor->aborted = True; talloc_free(ctdb->current_monitor->scripts); ctdb->current_monitor->scripts = NULL; talloc_free(ctdb->current_monitor); |