From: Martin Schwenke Date: Thu, 30 Sep 2021 11:14:14 +0000 (+1000) Subject: ctdb-recoverd: Add log reopening on SIGHUP to helpers X-Git-Tag: tdb-1.4.6~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97a45f6f25f34fff97a9be7ba2b346a4e8b93218;p=thirdparty%2Fsamba.git ctdb-recoverd: Add log reopening on SIGHUP to helpers Recovery and takeover helpers can run for a while and generate non-trivial logs. They should support log reopening. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/server/ctdb_recovery_helper.c b/ctdb/server/ctdb_recovery_helper.c index aa41aca8680..e0d32199ab9 100644 --- a/ctdb/server/ctdb_recovery_helper.c +++ b/ctdb/server/ctdb_recovery_helper.c @@ -3121,6 +3121,7 @@ int main(int argc, char *argv[]) TALLOC_CTX *mem_ctx = NULL; struct tevent_context *ev; struct ctdb_client_context *client; + bool status; int ret = 0; struct tevent_req *req; uint32_t generation; @@ -3160,6 +3161,12 @@ int main(int argc, char *argv[]) goto failed; } + status = logging_setup_sighup_handler(ev, mem_ctx, NULL, NULL); + if (!status) { + D_ERR("logging_setup_sighup_handler() failed\n"); + goto failed; + } + ret = ctdb_client_init(mem_ctx, ev, sockpath, &client); if (ret != 0) { D_ERR("ctdb_client_init() failed, ret=%d\n", ret); diff --git a/ctdb/server/ctdb_takeover_helper.c b/ctdb/server/ctdb_takeover_helper.c index ab8fb9bbe24..c088970e256 100644 --- a/ctdb/server/ctdb_takeover_helper.c +++ b/ctdb/server/ctdb_takeover_helper.c @@ -1193,6 +1193,7 @@ int main(int argc, const char *argv[]) TALLOC_CTX *mem_ctx; struct tevent_context *ev; struct ctdb_client_context *client; + bool status; int ret; struct tevent_req *req; uint32_t *force_rebalance_nodes = NULL; @@ -1235,6 +1236,13 @@ int main(int argc, const char *argv[]) goto done; } + status = logging_setup_sighup_handler(ev, mem_ctx, NULL, NULL); + if (!status) { + D_ERR("logging_setup_sighup_handler() failed\n"); + ret = ENOMEM; + goto done; + } + ret = ctdb_client_init(mem_ctx, ev, sockpath, &client); if (ret != 0) { D_ERR("ctdb_client_init() failed, ret=%d\n", ret);