Add ctdb_fork(0 which will fork a child process and drop the real-time
[sahlberg/ctdb.git] / server / eventscript.c
index aa8556d499ac9528f4650c8a239708f33a7298dd..9ba3a5d9ed802bdb2fe7c1f52bd506f6b7d4f080 100644 (file)
@@ -386,6 +386,9 @@ static int fork_child_for_script(struct ctdb_context *ctdb,
        if (state->child == 0) {
                int rt;
 
+               debug_extra = talloc_asprintf(NULL, "eventscript-%s-%s:",
+                                             current->name,
+                                             ctdb_eventscript_call_names[state->call]);
                close(state->fd[0]);
                set_close_on_exec(state->fd[1]);
 
@@ -508,9 +511,8 @@ static void debug_timeout(struct ctdb_event_script_state *state)
        sprintf(buf, "{ pstree -p; cat /proc/locks; ls -li /var/ctdb/ /var/ctdb/persistent; }"
                        " >/tmp/ctdb.event.%s.%d", tbuf, getpid());
 
-       pid = fork();
+       pid = ctdb_fork(state->ctdb);
        if (pid == 0) {
-               ctdb_reduce_priority(state->ctdb);
                system(buf);
                /* Now we can kill the child */
                kill(state->child, SIGTERM);
@@ -630,6 +632,7 @@ static bool check_options(enum ctdb_eventscript_call call, const char *options)
        case CTDB_EVENT_STATUS:
        case CTDB_EVENT_SHUTDOWN:
        case CTDB_EVENT_RELOAD:
+       case CTDB_EVENT_IPREALLOCATED:
                return count_words(options) == 0;
 
        case CTDB_EVENT_TAKE_IP: /* interface, IP address, netmask bits. */