]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-recoverd: Use this_node_is_leader() in an extra context
authorMartin Schwenke <martin@meltin.net>
Thu, 9 Dec 2021 00:47:54 +0000 (11:47 +1100)
committerMartin Schwenke <martins@samba.org>
Mon, 17 Jan 2022 10:21:32 +0000 (10:21 +0000)
This is arguably clearer.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_recoverd.c

index fbdd58204150b8e9197f3a2279e8d1128b5f338a..86752d6763225d2a93d695823540bf7b38bcfc18 100644 (file)
@@ -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;