summaryrefslogtreecommitdiffstats
path: root/ctdb
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2009-06-25 12:55:43 +1000
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2009-06-25 12:55:43 +1000
commit7f8d98ebb09049c9711d25f1300740756e460e45 (patch)
treef439d51657f25f5a7ea5270430803b66d7f47a31 /ctdb
parent10db6a41dff08af89435fd6823152f51729ac9be (diff)
downloadsamba-7f8d98ebb09049c9711d25f1300740756e460e45.tar.gz
samba-7f8d98ebb09049c9711d25f1300740756e460e45.tar.xz
samba-7f8d98ebb09049c9711d25f1300740756e460e45.zip
update the recovery daemon to read the recovery lock file off the main daemon and handle when the file is changed/enabled/disabled
(This used to be ctdb commit 31acc11a6389d4dd9f7b71b7cfa2f2450076f1f7)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/server/ctdb_recoverd.c62
1 files changed, 61 insertions, 1 deletions
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index 4072c66e7c..a367630f32 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -2506,6 +2506,60 @@ static int check_recovery_lock(struct ctdb_context *ctdb)
return 0;
}
+static int update_recovery_lock_file(struct ctdb_context *ctdb)
+{
+ TALLOC_CTX *tmp_ctx = talloc_new(NULL);
+ const char *reclockfile;
+
+ if (ctdb_ctrl_getreclock(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, tmp_ctx, &reclockfile) != 0) {
+ DEBUG(DEBUG_ERR,("Failed to read reclock file from daemon\n"));
+ talloc_free(tmp_ctx);
+ return -1;
+ }
+
+ if (reclockfile == NULL) {
+ if (ctdb->recovery_lock_file != NULL) {
+ 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->tunable.verify_recovery_lock = 0;
+ 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;
+ }
+ talloc_free(tmp_ctx);
+ return 0;
+ }
+
+
+ if (!strcmp(reclockfile, ctdb->recovery_lock_file)) {
+ talloc_free(tmp_ctx);
+ return 0;
+ }
+
+ talloc_free(ctdb->recovery_lock_file);
+ ctdb->recovery_lock_file = talloc_strdup(ctdb, reclockfile);
+ ctdb->tunable.verify_recovery_lock = 0;
+ if (ctdb->recovery_lock_fd != -1) {
+ close(ctdb->recovery_lock_fd);
+ ctdb->recovery_lock_fd = -1;
+ }
+
+ talloc_free(tmp_ctx);
+ return 0;
+}
+
/*
the main monitoring loop
*/
@@ -2612,7 +2666,13 @@ again:
goto again;
}
- /* Make sure that if recovery lock verification becomes disabled that
+ /* get the current recovery lock file from the server */
+ if (update_recovery_lock_file(ctdb) != 0) {
+ DEBUG(DEBUG_ERR,("Failed to update the recovery lock file\n"));
+ goto again;
+ }
+
+ /* Make sure that if recovery lock verification becomes disabled when
we close the file
*/
if (ctdb->tunable.verify_recovery_lock == 0) {