From ff0140e470016a7a2b5365c06f4d912e7a7c8af8 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Thu, 9 Dec 2021 11:47:54 +1100 Subject: [PATCH] ctdb-recoverd: Use this_node_is_leader() in an extra context This is arguably clearer. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/server/ctdb_recoverd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index fbdd5820415..86752d67632 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -856,7 +856,6 @@ static int helper_run(struct ctdb_recoverd *rec, TALLOC_CTX *mem_ctx, struct tevent_fd *fde; const char **args; int nargs, ret; - uint32_t recmaster = rec->recmaster; state = talloc_zero(mem_ctx, struct helper_state); if (state == NULL) { @@ -918,8 +917,7 @@ static int helper_run(struct ctdb_recoverd *rec, TALLOC_CTX *mem_ctx, while (!state->done) { tevent_loop_once(rec->ctdb->ev); - /* If recmaster changes, we have lost election */ - if (recmaster != rec->recmaster) { + if (!this_node_is_leader(rec)) { D_ERR("Recmaster changed to %u, aborting %s\n", rec->recmaster, type); state->result = 1;