aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-09-03 12:39:32 +1000
committerKarolin Seeger <kseeger@samba.org>2018-09-20 09:13:12 +0200
commit72a8c69935a7a5380689abd9a98df81291f6c812 (patch)
treebed7eee72aa7fb1279253f8510d2ad8f034ee50b
parent9745524234ab57aa8a895fb90a5dad35d9064ce4 (diff)
downloadsamba-72a8c69935a7a5380689abd9a98df81291f6c812.tar.gz
samba-72a8c69935a7a5380689abd9a98df81291f6c812.tar.xz
samba-72a8c69935a7a5380689abd9a98df81291f6c812.zip
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 <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit c52216740bd81b68876de06e104822bbbca86df9)
-rw-r--r--ctdb/server/ctdb_recoverd.c13
1 files changed, 7 insertions, 6 deletions
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;
}