ctdb: Use ctdb_wait_for_process_to_exit()
authorMartin Schwenke <martin@meltin.net>
Tue, 8 Dec 2015 03:20:59 +0000 (14:20 +1100)
committerAmitay Isaacs <amitay@samba.org>
Tue, 23 Feb 2016 06:23:18 +0000 (07:23 +0100)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_call.c
ctdb/server/ctdb_lock_helper.c
ctdb/server/ctdb_recover.c
ctdb/server/ctdb_takeover.c
ctdb/server/ctdb_traverse.c
ctdb/server/ctdb_update_record.c

index 510be7d7142b767d0a29af88d2a54ff1ce403e61..3478419fd4c0f2abbf352afa418f583cc7dd6fc1 100644 (file)
@@ -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);
        }
 
index 543c5d0eb7d65a5793f7ff796c75f39385bb55e1..4f1fe2d5e100992235b1edb013228dc9480890d5 100644 (file)
@@ -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;
 }
index dbbe9cfe2512a8f4c0864ec8a2e96e38ae6be6fe..7411dd26a1d1cd132faab7360affc108f971172d 100644 (file)
@@ -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]);
index 62af1e668d42dfa6d2dd76c2e0fa6cf40182321e..13276af665bc4a298b63174e17bab3ebd2ee1367 100644 (file)
@@ -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);
        }
 
index 73c3a066db9eb0e9825475a3dc8de9c7345c5b78..11a5385ba91355008acadbdb649214a47c27ed38 100644 (file)
@@ -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);
        }
 
index bc9c6fe06c37adc67605110f25a9fb7956f63f7d..56f3b837a4b25f0c6d050f5cad03dfd1526eec74 100644 (file)
@@ -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);
        }