[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.51-3-g3919698

Amitay Isaacs amitay at samba.org
Sat Oct 6 22:33:36 MDT 2012


The branch, 1.2.40 has been updated
       via  39196986c69f3a7751f2b3a69f242263d6864514 (commit)
       via  4f8d22453c04217f75330a642671dbec625f4b13 (commit)
       via  7d69ce7506db2bb6f363f9dc689e154cae4de7da (commit)
      from  0b7027db12ad83232e969c80e4ffbdcdb4a1adcd (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -----------------------------------------------------------------
commit 39196986c69f3a7751f2b3a69f242263d6864514
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Oct 5 12:05:19 2012 +1000

    New version 1.2.52
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 4f8d22453c04217f75330a642671dbec625f4b13
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Oct 2 11:51:24 2012 +1000

    util: ctdb_fork() closes all sockets opened by the main daemon
    
    Do some other housekeeping including stopping tevent.
    
    Pair-programmed-with: Amitay Isaacs <amitay at gmail.com>
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 7d69ce7506db2bb6f363f9dc689e154cae4de7da
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Oct 2 11:54:00 2012 +1000

    Revert "logging: Close unix socket /tmp/ctdb.socket in syslogd process"
    
    This reverts commit 450bedccbee3f89aba3b33777a4ae8841c456a65.
    
    This will be fixed in ctdb_fork() for all children.  Won't somebody
    PLEASE think of the children?!?

-----------------------------------------------------------------------

Summary of changes:
 client/ctdb_client.c       |   24 ++++++------------------
 common/ctdb_util.c         |   17 +++++++++++++++++
 packaging/RPM/ctdb.spec.in |    4 +++-
 server/ctdb_logging.c      |    5 -----
 4 files changed, 26 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 8b9df42..739c21b 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -4048,9 +4048,11 @@ int ctdb_ctrl_recd_ping(struct ctdb_context *ctdb)
 	return 0;
 }
 
-/* when forking the main daemon and the child process needs to connect back
- * to the daemon as a client process, this function can be used to change
- * the ctdb context from daemon into client mode
+/* When forking the main daemon and the child process needs to connect
+ * back to the daemon as a client process, this function can be used
+ * to change the ctdb context from daemon into client mode.  The child
+ * process must be created using ctdb_fork() and not fork() -
+ * ctdb_fork() does some necessary housekeeping.
  */
 int switch_from_server_to_client(struct ctdb_context *ctdb, const char *fmt, ...)
 {
@@ -4062,25 +4064,11 @@ int switch_from_server_to_client(struct ctdb_context *ctdb, const char *fmt, ...
 	debug_extra = talloc_strdup_append(talloc_vasprintf(NULL, fmt, ap), ":");
 	va_end(ap);
 
-	/* shutdown the transport */
-	if (ctdb->methods) {
-		ctdb->methods->shutdown(ctdb);
-	}
-
 	/* get a new event context */
-	talloc_free(ctdb->ev);
 	ctdb->ev = event_context_init(ctdb);
 	tevent_loop_allow_nesting(ctdb->ev);
 
-	close(ctdb->daemon.sd);
-	ctdb->daemon.sd = -1;
-
-	/* the client does not need to be realtime */
-	if (ctdb->do_setsched) {
-		ctdb_restore_scheduler(ctdb);
-	}
-
-	/* initialise ctdb */
+	/* Connect to main CTDB daemon */
 	ret = ctdb_socket_connect(ctdb);
 	if (ret != 0) {
 		DEBUG(DEBUG_ALERT, (__location__ " Failed to init ctdb client\n"));
diff --git a/common/ctdb_util.c b/common/ctdb_util.c
index bb212f5..dfd0b9f 100644
--- a/common/ctdb_util.c
+++ b/common/ctdb_util.c
@@ -367,6 +367,23 @@ pid_t ctdb_fork(struct ctdb_context *ctdb)
 
 	pid = fork();
 	if (pid == 0) {
+		/* Close the Unix Domain socket and the TCP socket.
+		 * This ensures that none of the child processes will
+		 * look like the main daemon when it is not running.
+		 * tevent needs to be stopped before closing sockets.
+		 */
+		if (ctdb->ev != NULL) {
+			talloc_free(ctdb->ev);
+			ctdb->ev = NULL;
+		}
+		if (ctdb->daemon.sd != -1) {
+			close(ctdb->daemon.sd);
+			ctdb->daemon.sd = -1;
+		}
+		if (ctdb->methods != NULL) {
+			ctdb->methods->shutdown(ctdb);
+		}
+
 		if (ctdb->do_setsched) {
 			ctdb_restore_scheduler(ctdb);
 		}
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index d057b34..73a49b7 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -3,7 +3,7 @@ Name: ctdb
 Summary: Clustered TDB
 Vendor: Samba Team
 Packager: Samba Team <samba at samba.org>
-Version: 1.2.51
+Version: 1.2.52
 Release: 1GITHASH
 Epoch: 0
 License: GNU GPL version 3
@@ -146,6 +146,8 @@ development libraries for ctdb
 
 %changelog
 
+* Fri Oct 05 2012 : Version 1.2.52
+  - util: ctdb_fork() closes all sockets opened by the main daemon
 * Tue Oct 02 2012 : Version 1.2.51
   - NATGW eventscript does not fail on recovered in case of misconfiguration
   - Map TEVENT_DEBUG_FATAL to DEBUG_CRIT
diff --git a/server/ctdb_logging.c b/server/ctdb_logging.c
index 0b32d85..19e8af7 100644
--- a/server/ctdb_logging.c
+++ b/server/ctdb_logging.c
@@ -117,11 +117,6 @@ int start_syslog_daemon(struct ctdb_context *ctdb)
 	}
 
 	debug_extra = talloc_asprintf(NULL, "syslogd:");
-
-	/* Close unix socket since syslogd does not need it */
-	close(ctdb->daemon.sd);
-	ctdb->daemon.sd = -1;
-
 	talloc_free(ctdb->ev);
 	ctdb->ev = event_context_init(NULL);
 	tevent_loop_allow_nesting(ctdb->ev);


-- 
CTDB repository


More information about the samba-cvs mailing list