Rev 669: merge from ronnie in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Tue Oct 23 01:45:37 GMT 2007


------------------------------------------------------------
revno: 669
revision-id: tridge at samba.org-20071023014536-wgztgi3xnxviqcoc
parent: tridge at samba.org-20071022111102-7odvx5778zw3c184
parent: sahlberg at ronnie-20071022051449-rd0vs7v3kexc24nz
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Tue 2007-10-23 11:45:36 +1000
message:
  merge from ronnie
modified:
  config/events.d/60.nfs         nfs-20070601141008-hy3h4qgbk1jd2jci-1
  include/ctdb_private.h         ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
  server/ctdb_control.c          ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1
  server/ctdb_recoverd.c         recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1
    ------------------------------------------------------------
    revno: 432.1.333
    revision-id: sahlberg at ronnie-20071022051449-rd0vs7v3kexc24nz
    parent: sahlberg at ronnie-20071022023451-9tcms7v97k7mj418
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Mon 2007-10-22 15:14:49 +1000
    message:
      nfs may take a while to stop   so do it in hte background
    modified:
      config/events.d/60.nfs         nfs-20070601141008-hy3h4qgbk1jd2jci-1
    ------------------------------------------------------------
    revno: 432.1.332
    revision-id: sahlberg at ronnie-20071022023451-9tcms7v97k7mj418
    parent: sahlberg at ronnie-20071022023408-kk14rzzmetvsgowe
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Mon 2007-10-22 12:34:51 +1000
    message:
      when shutting down, we should stop monitoring
    modified:
      server/ctdb_control.c          ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1
    ------------------------------------------------------------
    revno: 432.1.331
    revision-id: sahlberg at ronnie-20071022023408-kk14rzzmetvsgowe
    parent: sahlberg at ronnie-20071022001838-r8a5g20fm38xkzwv
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Mon 2007-10-22 12:34:08 +1000
    message:
      when we are shutting down, we should first shut down the recovery daemon
    modified:
      include/ctdb_private.h         ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
      server/ctdb_control.c          ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1
      server/ctdb_recoverd.c         recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1
=== modified file 'config/events.d/60.nfs'
--- a/config/events.d/60.nfs	2007-09-24 00:00:14 +0000
+++ b/config/events.d/60.nfs	2007-10-22 05:14:49 +0000
@@ -27,8 +27,9 @@
 	;;
 
      shutdown)
-	service nfs stop
-	service nfslock stop
+	# shutting down nfs can take a while so put it in the background
+	service nfs stop &
+	service nfslock stop &
 	exit 0
 	;;
 

=== modified file 'include/ctdb_private.h'
--- a/include/ctdb_private.h	2007-10-18 22:58:30 +0000
+++ b/include/ctdb_private.h	2007-10-22 02:34:08 +0000
@@ -365,6 +365,7 @@
 	struct _trbt_tree_t *server_ids;	
 	const char *event_script_dir;
 	const char *default_public_interface;
+	pid_t recoverd_pid;
 };
 
 struct ctdb_db_context {
@@ -1038,6 +1039,7 @@
 int32_t ctdb_control_thaw(struct ctdb_context *ctdb);
 
 int ctdb_start_recoverd(struct ctdb_context *ctdb);
+void ctdb_stop_recoverd(struct ctdb_context *ctdb);
 
 uint32_t ctdb_get_num_active_nodes(struct ctdb_context *ctdb);
 

=== modified file 'server/ctdb_control.c'
--- a/server/ctdb_control.c	2007-10-09 01:56:09 +0000
+++ b/server/ctdb_control.c	2007-10-22 02:34:51 +0000
@@ -232,6 +232,8 @@
 		return ctdb->monitoring_mode;
 
 	case CTDB_CONTROL_SHUTDOWN:
+		ctdb_stop_recoverd(ctdb);
+		ctdb_stop_monitoring(ctdb);
 		ctdb_release_all_ips(ctdb);
 		ctdb->methods->shutdown(ctdb);
 		ctdb_event_script(ctdb, "shutdown");

=== modified file 'server/ctdb_recoverd.c'
--- a/server/ctdb_recoverd.c	2007-10-18 06:27:36 +0000
+++ b/server/ctdb_recoverd.c	2007-10-22 02:34:08 +0000
@@ -22,6 +22,7 @@
 #include "system/filesys.h"
 #include "system/time.h"
 #include "system/network.h"
+#include "system/wait.h"
 #include "popt.h"
 #include "cmdline.h"
 #include "../include/ctdb.h"
@@ -1950,18 +1951,17 @@
 {
 	int ret;
 	int fd[2];
-	pid_t child;
 
 	if (pipe(fd) != 0) {
 		return -1;
 	}
 
-	child = fork();
-	if (child == -1) {
+	ctdb->recoverd_pid = fork();
+	if (ctdb->recoverd_pid == -1) {
 		return -1;
 	}
 	
-	if (child != 0) {
+	if (ctdb->recoverd_pid != 0) {
 		close(fd[0]);
 		return 0;
 	}
@@ -1995,3 +1995,16 @@
 	DEBUG(0,("ERROR: ctdb_recoverd finished!?\n"));
 	return -1;
 }
+
+/*
+  shutdown the recovery daemon
+ */
+void ctdb_stop_recoverd(struct ctdb_context *ctdb)
+{
+	if (ctdb->recoverd_pid == 0) {
+		return;
+	}
+
+	DEBUG(0,("Shutting down recovery daemon\n"));
+	kill(ctdb->recoverd_pid, SIGTERM);
+}



More information about the samba-cvs mailing list