1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

ctdb-recoverd: New function ctdb_recovery_have_lock()

True if this recovery daemon holds the lock.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2014-12-09 13:50:22 +11:00 committed by Amitay Isaacs
parent 4d3b52f1ce
commit 72701be663
3 changed files with 8 additions and 2 deletions

View File

@ -1259,6 +1259,7 @@ void ctdb_release_all_ips(struct ctdb_context *ctdb);
void set_nonblocking(int fd);
void set_close_on_exec(int fd);
bool ctdb_recovery_have_lock(struct ctdb_context *ctdb);
bool ctdb_recovery_lock(struct ctdb_context *ctdb, bool keep);
int ctdb_set_recovery_lock_file(struct ctdb_context *ctdb, const char *file);

View File

@ -721,6 +721,11 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
}
bool ctdb_recovery_have_lock(struct ctdb_context *ctdb)
{
return ctdb->recovery_lock_fd != -1;
}
/*
try and get the recovery lock in shared storage - should only work
on the recovery master recovery daemon. Anywhere else is a bug

View File

@ -2679,7 +2679,7 @@ static void election_handler(struct ctdb_context *ctdb, uint64_t srvid,
/*unban_all_nodes(ctdb);*/
return;
}
/* we didn't win */
talloc_free(rec->send_election_te);
rec->send_election_te = NULL;
@ -2687,7 +2687,7 @@ static void election_handler(struct ctdb_context *ctdb, uint64_t srvid,
if (ctdb->recovery_lock_file != NULL) {
/* Release the recovery lock file */
if (em->pnn != ctdb->pnn &&
ctdb->recovery_lock_fd != -1) {
ctdb_recovery_have_lock(ctdb)) {
DEBUG(DEBUG_NOTICE, ("Release the recovery lock\n"));
close(ctdb->recovery_lock_fd);
ctdb->recovery_lock_fd = -1;