From 72a8c69935a7a5380689abd9a98df81291f6c812 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Mon, 3 Sep 2018 12:39:32 +1000 Subject: ctdb-recoverd: Store recovery lock handle ... not just cluster mutex handle. This makes the recovery lock handle long-lived and with allow the releasing code to cancel an in-progress attempt to take the recovery lock. The cluster mutex handle is now allocated off the recovery lock handle. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13617 Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs (cherry picked from commit c52216740bd81b68876de06e104822bbbca86df9) --- ctdb/server/ctdb_recoverd.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'ctdb') diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index 341e4c82fb9..3df319bb022 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -237,6 +237,8 @@ struct ctdb_banning_state { struct timeval last_reported_time; }; +struct ctdb_recovery_lock_handle; + /* private state of recovery daemon */ @@ -258,7 +260,7 @@ struct ctdb_recoverd { uint32_t *force_rebalance_nodes; struct ctdb_node_capabilities *caps; bool frozen_on_inactive; - struct ctdb_cluster_mutex_handle *recovery_lock_handle; + struct ctdb_recovery_lock_handle *recovery_lock_handle; }; #define CONTROL_TIMEOUT() timeval_current_ofs(ctdb->tunable.recover_timeout, 0) @@ -883,6 +885,7 @@ struct ctdb_recovery_lock_handle { bool done; bool locked; double latency; + struct ctdb_cluster_mutex_handle *h; }; static void take_reclock_handler(char status, @@ -938,7 +941,7 @@ static bool ctdb_recovery_lock(struct ctdb_recoverd *rec) return false; }; - h = ctdb_cluster_mutex(rec, + h = ctdb_cluster_mutex(s, ctdb, ctdb->recovery_lock, 0, @@ -957,17 +960,15 @@ static bool ctdb_recovery_lock(struct ctdb_recoverd *rec) if (! s->locked) { talloc_free(s); - talloc_free(h); return false; } - rec->recovery_lock_handle = h; + rec->recovery_lock_handle = s; + s->h = h; ctdb_ctrl_report_recd_lock_latency(ctdb, CONTROL_TIMEOUT(), s->latency); - talloc_free(s); - return true; } -- cgit v1.2.1