From 6695fa50aed43ad2b2998197ae79fa768f5a89d7 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Tue, 8 Dec 2015 14:20:59 +1100 Subject: [PATCH] ctdb: Use ctdb_wait_for_process_to_exit() Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/server/ctdb_call.c | 5 +---- ctdb/server/ctdb_lock_helper.c | 4 +--- ctdb/server/ctdb_recover.c | 5 +---- ctdb/server/ctdb_takeover.c | 5 +---- ctdb/server/ctdb_traverse.c | 4 +--- ctdb/server/ctdb_update_record.c | 5 +---- 6 files changed, 6 insertions(+), 22 deletions(-) diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c index 510be7d7142..3478419fd4c 100644 --- a/ctdb/server/ctdb_call.c +++ b/ctdb/server/ctdb_call.c @@ -1865,10 +1865,7 @@ int ctdb_start_revoke_ro_record(struct ctdb_context *ctdb, struct ctdb_db_contex child_finished: sys_write(rc->fd[1], &c, 1); - /* make sure we die when our parent dies */ - while (ctdb_kill(ctdb, parent, 0) == 0 || errno != ESRCH) { - sleep(5); - } + ctdb_wait_for_process_to_exit(parent); _exit(0); } diff --git a/ctdb/server/ctdb_lock_helper.c b/ctdb/server/ctdb_lock_helper.c index 543c5d0eb7d..4f1fe2d5e10 100644 --- a/ctdb/server/ctdb_lock_helper.c +++ b/ctdb/server/ctdb_lock_helper.c @@ -182,8 +182,6 @@ int main(int argc, char *argv[]) send_result(write_fd, result); - while (kill(ppid, 0) == 0 || errno != ESRCH) { - sleep(5); - } + ctdb_wait_for_process_to_exit(ppid); return 0; } diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c index dbbe9cfe251..7411dd26a1d 100644 --- a/ctdb/server/ctdb_recover.c +++ b/ctdb/server/ctdb_recover.c @@ -647,10 +647,7 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb, } sys_write(state->fd[1], &cc, 1); - /* make sure we die when our parent dies */ - while (ctdb_kill(ctdb, parent, 0) == 0 || errno != ESRCH) { - sleep(5); - } + ctdb_wait_for_process_to_exit(parent); _exit(0); } close(state->fd[1]); diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index 62af1e668d4..13276af665b 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -3824,10 +3824,7 @@ int32_t ctdb_control_reload_public_ips(struct ctdb_context *ctdb, struct ctdb_re } sys_write(h->fd[1], &res, 1); - /* make sure we die when our parent dies */ - while (ctdb_kill(ctdb, parent, 0) == 0 || errno != ESRCH) { - sleep(5); - } + ctdb_wait_for_process_to_exit(parent); _exit(0); } diff --git a/ctdb/server/ctdb_traverse.c b/ctdb/server/ctdb_traverse.c index 73c3a066db9..11a5385ba91 100644 --- a/ctdb/server/ctdb_traverse.c +++ b/ctdb/server/ctdb_traverse.c @@ -260,9 +260,7 @@ static struct ctdb_traverse_local_handle *ctdb_traverse_local(struct ctdb_db_con sys_write(h->fd[1], &res, sizeof(res)); - while (ctdb_kill(ctdb, parent, 0) == 0 || errno != ESRCH) { - sleep(5); - } + ctdb_wait_for_process_to_exit(parent); _exit(0); } diff --git a/ctdb/server/ctdb_update_record.c b/ctdb/server/ctdb_update_record.c index bc9c6fe06c3..56f3b837a4b 100644 --- a/ctdb/server/ctdb_update_record.c +++ b/ctdb/server/ctdb_update_record.c @@ -276,10 +276,7 @@ static struct childwrite_handle *ctdb_childwrite( sys_write(result->fd[1], &c, 1); - /* make sure we die when our parent dies */ - while (ctdb_kill(ctdb_db->ctdb, parent, 0) == 0 || errno != ESRCH) { - sleep(5); - } + ctdb_wait_for_process_to_exit(parent); _exit(0); }