mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
ctdb-recoverd: Abort recovery/takeover if recmaster changes
Recovery and takeover are run via helper from recovery daemon. While the helpers are running, it's possible for the current node to lose election. If that happens, abort the currently running recovery/takeover helper. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
parent
f57d379446
commit
6e588913dd
@ -1026,6 +1026,7 @@ 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) {
|
||||
@ -1085,6 +1086,14 @@ 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) {
|
||||
D_ERR("Recmaster changed to %u, aborting %s\n",
|
||||
rec->recmaster, type);
|
||||
state->result = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
close(state->fd[0]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user