From: Martin Schwenke Date: Tue, 12 May 2026 07:40:05 +0000 (+1000) Subject: ctdb-recoverd: Do not allow nested elections X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d28f8ed17c867f306ca900bd912e8b75c5c7be8b;p=thirdparty%2Fsamba.git ctdb-recoverd: Do not allow nested elections This appears to show nested elections: 2026-05-12T12:15:56.130174+05:30 nsds1 ctdb-recoverd[826]: Leader broadcast timeout 2026-05-12T12:15:56.130206+05:30 nsds1 ctdb-recoverd[826]: Start election 2026-05-12T12:15:56.130329+05:30 nsds1 ctdb-recoverd[826]: Attempting to take cluster lock (!/usr/libexec/ctdb/ctdb_mutex_fcntl_helper /mnt/lustre/mac167/nsds_conf/.nsds_config/cluster_lock 5 20) 2026-05-12T12:16:01.131882+05:30 nsds1 ctdb-recoverd[826]: Leader broadcast timeout 2026-05-12T12:16:01.131918+05:30 nsds1 ctdb-recoverd[826]: Start election There is no sign that the first election ended. Starting another one causes bad state interactions. Apart from causing confusion for multiple pieces of state (e.g. rec->election_in_progress), a nested call to _cluster_lock_lock() will leak rec->cluster_lock_handle because it will overwrite it with the new in-progress handle. BUG: https://bugzilla.samba.org/show_bug.cgi?id=16152 Reported-by: Agam S Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs Autobuild-User(master): Amitay Isaacs Autobuild-Date(master): Thu Jul 9 15:24:42 UTC 2026 on atb-devel-224 --- diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index 40a6aadd40f..aacf886dae8 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -1918,6 +1918,11 @@ static void force_election(struct ctdb_recoverd *rec) D_ERR("Start election\n"); + /* Do not allow nested elections */ + if (rec->election_in_progress) { + return; + } + /* set all nodes to recovery mode to stop all internode traffic */ ret = set_recovery_mode(ctdb, rec, rec->nodemap, CTDB_RECOVERY_ACTIVE); if (ret != 0) {