return true;
}
+void ctdb_recovery_unlock(struct ctdb_context *ctdb)
+{
+ if (ctdb->recovery_lock_fd != -1) {
+ DEBUG(DEBUG_NOTICE, ("Releasing recovery lock\n"));
+ close(ctdb->recovery_lock_fd);
+ ctdb->recovery_lock_fd = -1;
+ }
+}
+
/*
delete a record as part of the vacuum process
only delete if we are not lmaster or dmaster, and our rsn is <= the provided rsn
/* Release the recovery lock file */
if (em->pnn != ctdb->pnn &&
ctdb_recovery_have_lock(ctdb)) {
- DEBUG(DEBUG_NOTICE, ("Release the recovery lock\n"));
- close(ctdb->recovery_lock_fd);
- ctdb->recovery_lock_fd = -1;
+ ctdb_recovery_unlock(ctdb);
unban_all_nodes(ctdb);
}
}
DEBUG(DEBUG_ERR,("Reclock file disabled\n"));
talloc_free(ctdb->recovery_lock_file);
ctdb->recovery_lock_file = NULL;
- if (ctdb->recovery_lock_fd != -1) {
- close(ctdb->recovery_lock_fd);
- ctdb->recovery_lock_fd = -1;
- }
+ ctdb_recovery_unlock(ctdb);
}
talloc_free(tmp_ctx);
return 0;
if (ctdb->recovery_lock_file == NULL) {
ctdb->recovery_lock_file = talloc_strdup(ctdb, reclockfile);
- if (ctdb->recovery_lock_fd != -1) {
- close(ctdb->recovery_lock_fd);
- ctdb->recovery_lock_fd = -1;
- }
+ ctdb_recovery_unlock(ctdb);
talloc_free(tmp_ctx);
return 0;
}
talloc_free(ctdb->recovery_lock_file);
ctdb->recovery_lock_file = talloc_strdup(ctdb, reclockfile);
- if (ctdb->recovery_lock_fd != -1) {
- close(ctdb->recovery_lock_fd);
- ctdb->recovery_lock_fd = -1;
- }
+ ctdb_recovery_unlock(ctdb);
talloc_free(tmp_ctx);
return 0;
we close the file
*/
if (ctdb->recovery_lock_file == NULL) {
- if (ctdb->recovery_lock_fd != -1) {
- close(ctdb->recovery_lock_fd);
- ctdb->recovery_lock_fd = -1;
- }
+ ctdb_recovery_unlock(ctdb);
}
pnn = ctdb_get_pnn(ctdb);