diff options
author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2012-05-03 11:42:41 +1000 |
---|---|---|
committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2012-05-03 14:03:26 +1000 |
commit | a57eba2bb49b32f3dc69542de69b8b74ec9d3d09 (patch) | |
tree | 020fe37817cc3736da55a60b7e9912de23a91b9b /ctdb/server/ctdb_update_record.c | |
parent | 85432ecc5383fe4aa0fc1af9d816b17cc0629f1e (diff) | |
download | samba-a57eba2bb49b32f3dc69542de69b8b74ec9d3d09.tar.gz samba-a57eba2bb49b32f3dc69542de69b8b74ec9d3d09.tar.xz samba-a57eba2bb49b32f3dc69542de69b8b74ec9d3d09.zip |
Track all child process so we never send a signal to an unrelated process (our child died and kernel wrapped the pid-space and reused the pid for a different process
Wrap all creation of child processes inside ctdb_fork() which is used to track all processes we have spawned.
Capture SIGCHLD to track also which child processes have terminated.
Wrap kill() inside ctdb_kill() and make sure that we never send a !0 signal to a child process pid that has already terminated (and might have been replaced with a
(This used to be ctdb commit f73a4b1495830bcdd094a93732a89dd53b3c2f78)
Diffstat (limited to 'ctdb/server/ctdb_update_record.c')
-rw-r--r-- | ctdb/server/ctdb_update_record.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ctdb/server/ctdb_update_record.c b/ctdb/server/ctdb_update_record.c index 92b304c08a7..1543b4687bf 100644 --- a/ctdb/server/ctdb_update_record.c +++ b/ctdb/server/ctdb_update_record.c @@ -162,7 +162,7 @@ struct childwrite_handle { static int childwrite_destructor(struct childwrite_handle *h) { CTDB_DECREMENT_STAT(h->ctdb, pending_childwrite_calls); - kill(h->child, SIGKILL); + ctdb_kill(h->ctdb, h->child, SIGKILL); return 0; } @@ -199,7 +199,7 @@ static void childwrite_handler(struct event_context *ev, struct fd_event *fde, callback(c, p); - kill(child, SIGKILL); + ctdb_kill(h->ctdb, child, SIGKILL); talloc_free(tmp_ctx); } @@ -260,7 +260,7 @@ static struct childwrite_handle *ctdb_childwrite( write(result->fd[1], &c, 1); /* make sure we die when our parent dies */ - while (kill(parent, 0) == 0 || errno != ESRCH) { + while (ctdb_kill(ctdb_db->ctdb, parent, 0) == 0 || errno != ESRCH) { sleep(5); } _exit(0); |