[SCM] CTDB repository - branch 2.5 updated - ctdb-2.5.1-14-g4121d33

Amitay Isaacs amitay at samba.org
Wed Jan 15 22:36:24 MST 2014


The branch, 2.5 has been updated
       via  4121d33fcd53aa1fc241137724f30119aa750d34 (commit)
       via  2c97de1aff47e84632f33551de5e35235b0a5eba (commit)
       via  d4a6a163c9f13571129adc5ccf2af7aea5752eee (commit)
       via  c8ae0a143752312712362e5c74852dd148f8e83b (commit)
       via  a98d929e529ae17db055fe9ed211e2a603e5a915 (commit)
       via  aac23f355f9502628d950bc0b7900af3e2b450d5 (commit)
       via  b9f2e27d21bf849e57da410c90580878d94ed539 (commit)
       via  7cfa02939ac69402d62ac7aeb43a66445ea0cc40 (commit)
       via  33e1d0e188ce2d394c7155cb214b76282ba4e9da (commit)
       via  16f5bb0067e888ecb82f853fd83d0591ae32b690 (commit)
      from  e42c7e328d0dcf38deb1395714a6e9a24e86e283 (commit)

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


- Log -----------------------------------------------------------------
commit 4121d33fcd53aa1fc241137724f30119aa750d34
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Dec 18 14:09:52 2013 +1100

    daemon: Remove ctdb_fork_with_logging()
    
    This function has been replaced with ctdb_vfork_with_logging().
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Thu Jan 16 04:05:35 CET 2014 on sn-devel-104
    
    (Imported from commit a92fd11ad1ccc904a999a254d249bbdc74f08f84)

commit 2c97de1aff47e84632f33551de5e35235b0a5eba
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Mon Jan 13 15:16:46 2014 +1100

    tests: Set CTDB_EVENT_HELPER when running with local daemons
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    (Imported from commit dd98b9df6651054dabefdf439735042a78cfea2e)

commit d4a6a163c9f13571129adc5ccf2af7aea5752eee
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Dec 17 19:22:20 2013 +1100

    daemon: Remove unused code to run eventscripts
    
    Eventscripts are now executed using a helper.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    (Imported from commit 97575e1ba0b7fecef2b26f2da1c0d8cb769a37a8)

commit c8ae0a143752312712362e5c74852dd148f8e83b
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Dec 18 14:07:57 2013 +1100

    daemon: Replace ctdb_fork_with_logging with ctdb_vfork_with_logging (part 2)
    
    Use ctdb_event_helper to run debug-hung-script.sh.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    (Imported from commit 18c1f432102f1a5093927be9276d001180539e50)

commit a98d929e529ae17db055fe9ed211e2a603e5a915
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Dec 17 19:19:51 2013 +1100

    daemon: Replace ctdb_fork_with_logging with ctdb_vfork_with_logging (part 1)
    
    Use ctdb_event_helper to run eventscripts.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    (Imported from commit d86662a925a072eb0374ad7743f4cf95c447bebb)

commit aac23f355f9502628d950bc0b7900af3e2b450d5
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Mon Dec 16 15:40:01 2013 +1100

    daemon: Add helper process to execute event scripts
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    (Imported from commit 69324b61f0669022c7204ee08a4c7104865d4e9b)

commit b9f2e27d21bf849e57da410c90580878d94ed539
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Mon Dec 16 15:39:29 2013 +1100

    daemon: Add ctdb_vfork_with_logging()
    
    This will be used to spawn lightweight helper processes to run
    eventscripts.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    (Imported from commit 2879404388ed04af199a7e4451605b4435e8cc23)

commit 7cfa02939ac69402d62ac7aeb43a66445ea0cc40
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Mon Dec 16 15:57:42 2013 +1100

    daemon: No need to call event scripts with CTDB_CALLED_BY_USER
    
    This was added to support external monitoring using CTDB event scripts.
    However, it was never used.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    (Imported from commit 7aa20ccb5c747707fca349e9e0847cd0fca8c839)

commit 33e1d0e188ce2d394c7155cb214b76282ba4e9da
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Mon Dec 23 11:46:48 2013 +1100

    daemon: Deprecate RELOAD and STATUS events
    
    These events have never been used.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    (Imported from commit bafa467021b7b2f17c61904b9f70f695a4395921)

commit 16f5bb0067e888ecb82f853fd83d0591ae32b690
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Dec 17 19:48:29 2013 +1100

    common: mkdir_p should not try to create .
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    (Imported from commit b8c6bcc365ce08ddc0ebf51c002d53c08f144981)

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

Summary of changes:
 Makefile.in                    |    7 +-
 common/system_common.c         |    4 +
 include/ctdb_private.h         |   17 ++-
 include/ctdb_protocol.h        |    4 +-
 packaging/RPM/ctdb.spec.in     |    1 +
 server/ctdb_daemon.c           |    1 -
 server/ctdb_event_helper.c     |  136 ++++++++++++++++++++
 server/ctdb_logging.c          |   62 ++++++----
 server/ctdb_monitor.c          |    4 +-
 server/ctdb_recover.c          |    3 +-
 server/ctdb_takeover.c         |    6 +-
 server/eventscript.c           |  266 ++++++++++++++++------------------------
 tests/scripts/integration.bash |    1 +
 13 files changed, 308 insertions(+), 204 deletions(-)
 create mode 100644 server/ctdb_event_helper.c


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 1038e71..d8397b8 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -120,7 +120,7 @@ TEST_BINS=tests/bin/ctdb_bench tests/bin/ctdb_fetch tests/bin/ctdb_fetch_one \
 	@INFINIBAND_BINS@
 
 BINS = bin/ctdb @CTDB_SCSI_IO@ bin/smnotify bin/ping_pong bin/ltdbtool \
-       bin/ctdb_lock_helper @CTDB_PMDA@
+       bin/ctdb_lock_helper bin/ctdb_event_helper @CTDB_PMDA@
 
 SBINS = bin/ctdbd
 
@@ -178,6 +178,10 @@ bin/ctdb_lock_helper: server/ctdb_lock_helper.o lib/util/util_file.o $(CTDB_EXTE
 	@echo Linking $@
 	$(WRAPPER) $(CC) $(CFLAGS) -o $@ server/ctdb_lock_helper.o lib/util/util_file.o $(CTDB_EXTERNAL_OBJ) $(TDB_LIBS) $(LIB_FLAGS)
 
+bin/ctdb_event_helper: server/ctdb_event_helper.o $(SOCKET_WRAPPER_OBJ)
+	@echo Linking $@
+	$(WRAPPER) $(CC) $(CFLAGS) -o $@ server/ctdb_event_helper.o  $(SOCKET_WRAPPER_OBJ) $(LIB_FLAGS)
+
 bin/smnotify: utils/smnotify/gen_xdr.o utils/smnotify/gen_smnotify.o utils/smnotify/smnotify.o $(POPT_OBJ)
 	@echo Linking $@
 	$(WRAPPER) $(CC) $(CFLAGS) -o $@ utils/smnotify/smnotify.o utils/smnotify/gen_xdr.o utils/smnotify/gen_smnotify.o $(POPT_OBJ) $(LIB_FLAGS)
@@ -332,6 +336,7 @@ install: all manpages $(PMDA_INSTALL)
 	$(INSTALLCMD) -m 755 bin/ping_pong $(DESTDIR)$(bindir)
 	$(INSTALLCMD) -m 755 bin/ltdbtool $(DESTDIR)$(bindir)
 	$(INSTALLCMD) -m 755 bin/ctdb_lock_helper $(DESTDIR)$(bindir)
+	$(INSTALLCMD) -m 755 bin/ctdb_event_helper $(DESTDIR)$(bindir)
 	${INSTALLCMD} -m 644 include/ctdb.h $(DESTDIR)$(includedir)
 	${INSTALLCMD} -m 644 include/ctdb_client.h $(DESTDIR)$(includedir)
 	${INSTALLCMD} -m 644 include/ctdb_protocol.h $(DESTDIR)$(includedir)
diff --git a/common/system_common.c b/common/system_common.c
index 7563ff3..cc22f69 100644
--- a/common/system_common.c
+++ b/common/system_common.c
@@ -169,6 +169,10 @@ int mkdir_p(const char *dir, int mode)
 		return 0;
 	}
 
+	if (strcmp(dir, ".") == 0) {
+		return 0;
+	}
+
 	t = talloc_strdup(NULL, dir);
 	if (t == NULL) {
 		return ENOMEM;
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 71c9f13..5c18d87 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1245,9 +1245,8 @@ int ctdb_event_script_callback(struct ctdb_context *ctdb,
 			       TALLOC_CTX *mem_ctx,
 			       void (*callback)(struct ctdb_context *, int, void *),
 			       void *private_data,
-			       bool from_user,
 			       enum ctdb_eventscript_call call,
-			       const char *fmt, ...) PRINTF_ATTRIBUTE(7,8);
+			       const char *fmt, ...) PRINTF_ATTRIBUTE(6,7);
 void ctdb_release_all_ips(struct ctdb_context *ctdb);
 
 void set_nonblocking(int fd);
@@ -1457,11 +1456,15 @@ int32_t ctdb_control_get_log(struct ctdb_context *ctdb, TDB_DATA addr);
 int32_t ctdb_control_clear_log(struct ctdb_context *ctdb);
 void ctdb_log_ringbuffer_free(void);
 
-struct ctdb_log_state *ctdb_fork_with_logging(TALLOC_CTX *mem_ctx,
-					      struct ctdb_context *ctdb,
-					      const char *log_prefix,
-					      void (*logfn)(const char *, uint16_t, void *),
-					      void *logfn_private, pid_t *pid);
+struct ctdb_log_state *ctdb_vfork_with_logging(TALLOC_CTX *mem_ctx,
+					       struct ctdb_context *ctdb,
+					       const char *log_prefix,
+					       const char *helper,
+					       int helper_argc,
+					       const char **helper_argv,
+					       void (*logfn)(const char *, uint16_t, void *),
+					       void *logfn_private, pid_t *pid);
+
 
 int32_t ctdb_control_process_exists(struct ctdb_context *ctdb, pid_t pid);
 struct ctdb_client *ctdb_find_client_by_pid(struct ctdb_context *ctdb, pid_t pid);
diff --git a/include/ctdb_protocol.h b/include/ctdb_protocol.h
index 15c87be..fa03a4b 100644
--- a/include/ctdb_protocol.h
+++ b/include/ctdb_protocol.h
@@ -240,9 +240,9 @@ enum ctdb_eventscript_call {
 	CTDB_EVENT_RELEASE_IP,		/* IP released: interface, IP address, netmask bits. */
 	CTDB_EVENT_STOPPED,		/* Deprecated, do not use. */
 	CTDB_EVENT_MONITOR,		/* Please check if service is healthy: no args. */
-	CTDB_EVENT_STATUS,		/* Report service status: no args. */
+	CTDB_EVENT_STATUS,		/* Deprecated, do not use. */
 	CTDB_EVENT_SHUTDOWN,		/* CTDB shutting down: no args. */
-	CTDB_EVENT_RELOAD,		/* magic */
+	CTDB_EVENT_RELOAD,		/* Deprecated, do not use */
 	CTDB_EVENT_UPDATE_IP,		/* IP updating: old interface, new interface, IP address, netmask bits. */
 	CTDB_EVENT_IPREALLOCATED,	/* when a takeover_run() completes */
 	CTDB_EVENT_MAX
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index e3a3486..b2520c3 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -192,6 +192,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_sbindir}/ctdbd_wrapper
 %{_bindir}/ctdb
 %{_bindir}/ctdb_lock_helper
+%{_bindir}/ctdb_event_helper
 %{_bindir}/smnotify
 %{_bindir}/ping_pong
 %{_bindir}/ltdbtool
diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c
index 50b2de3..aa0cedb 100644
--- a/server/ctdb_daemon.c
+++ b/server/ctdb_daemon.c
@@ -1312,7 +1312,6 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog)
 					 ctdb,
 					 ctdb_setup_event_callback,
 					 ctdb,
-					 false,
 					 CTDB_EVENT_SETUP,
 					 "%s",
 					 "");
diff --git a/server/ctdb_event_helper.c b/server/ctdb_event_helper.c
new file mode 100644
index 0000000..4c62e41
--- /dev/null
+++ b/server/ctdb_event_helper.c
@@ -0,0 +1,136 @@
+/*
+   ctdb event script helper
+
+   Copyright (C) Amitay Isaacs  2013
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "system/filesys.h"
+
+static char *progname = NULL;
+
+
+/* CTDB sends SIGTERM, when process must die */
+static void sigterm(int sig)
+{
+	pid_t pid;
+
+	/* all the child processes are running in the same process group */
+	pid = getpgrp();
+	if (pid == -1) {
+		kill(-getpid(), SIGKILL);
+	} else {
+		kill(-pid, SIGKILL);
+	}
+	_exit(0);
+}
+
+static void set_close_on_exec(int fd)
+{
+	int v;
+
+	v = fcntl(fd, F_GETFD, 0);
+	if (v == -1) {
+		return;
+	}
+	fcntl(fd, F_SETFD, v | FD_CLOEXEC);
+}
+
+static int check_executable(const char *path)
+{
+	struct stat st;
+
+	if (stat(path, &st) != 0) {
+		fprintf(stderr, "Failed to access '%s' - %s\n",
+			path, strerror(errno));
+		return errno;
+	}
+
+	if (!(st.st_mode & S_IXUSR)) {
+		return ENOEXEC;
+	}
+
+	return 0;
+}
+
+static void usage(void)
+{
+	fprintf(stderr, "\n");
+	fprintf(stderr, "Usage: %s <log-fd> <output-fd> <script_path> <event> [<args>]\n",
+		progname);
+}
+
+int main(int argc, char *argv[])
+{
+	int log_fd, write_fd;
+	pid_t pid;
+	int status, output;
+
+	progname = argv[0];
+
+	if (argc < 5) {
+		usage();
+		exit(1);
+	}
+
+	log_fd = atoi(argv[1]);
+	write_fd = atoi(argv[2]);
+
+	set_close_on_exec(write_fd);
+
+	close(STDOUT_FILENO);
+	close(STDERR_FILENO);
+	dup2(log_fd, STDOUT_FILENO);
+	dup2(log_fd, STDERR_FILENO);
+	close(log_fd);
+
+	if (setpgid(0, 0) != 0) {
+		fprintf(stderr, "Failed to create process group for event script - %s\n",
+			strerror(errno));
+		exit(1);
+	}
+
+	signal(SIGTERM, sigterm);
+
+	pid = fork();
+	if (pid < 0) {
+		fprintf(stderr, "Failed to fork - %s\n", strerror(errno));
+		exit(errno);
+	}
+
+	if (pid == 0) {
+		int save_errno;
+
+		execv(argv[3], &argv[3]);
+		if (errno == EACCES) {
+			save_errno = check_executable(argv[3]);
+		} else {
+			save_errno = errno;
+			fprintf(stderr, "Error executing '%s' - %s\n",
+				argv[3], strerror(errno));
+		}
+		_exit(save_errno);
+	}
+
+	waitpid(pid, &status, 0);
+	if (WIFEXITED(status)) {
+		output = -WEXITSTATUS(status);
+		write(write_fd, &output, sizeof(output));
+		exit(output);
+	}
+
+	exit(1);
+}
diff --git a/server/ctdb_logging.c b/server/ctdb_logging.c
index 17c5c35..d334191 100644
--- a/server/ctdb_logging.c
+++ b/server/ctdb_logging.c
@@ -469,56 +469,73 @@ static int log_context_destructor(struct ctdb_log_state *log)
 }
 
 /*
-   fork(), redirecting child output to logging and specified callback.
-*/
-struct ctdb_log_state *ctdb_fork_with_logging(TALLOC_CTX *mem_ctx,
-					      struct ctdb_context *ctdb,
-					      const char *log_prefix,
-					      void (*logfn)(const char *, uint16_t, void *),
-					      void *logfn_private, pid_t *pid)
+ * vfork + exec, redirecting child output to logging and specified callback.
+ */
+struct ctdb_log_state *ctdb_vfork_with_logging(TALLOC_CTX *mem_ctx,
+					       struct ctdb_context *ctdb,
+					       const char *log_prefix,
+					       const char *helper,
+					       int helper_argc,
+					       const char **helper_argv,
+					       void (*logfn)(const char *, uint16_t, void *),
+					       void *logfn_private, pid_t *pid)
 {
 	int p[2];
 	struct ctdb_log_state *log;
 	struct tevent_fd *fde;
+	char **argv;
+	int i;
 
 	log = talloc_zero(mem_ctx, struct ctdb_log_state);
 	CTDB_NO_MEMORY_NULL(ctdb, log);
+
 	log->ctdb = ctdb;
 	log->prefix = log_prefix;
 	log->logfn = logfn;
-	log->logfn_private = (void *)logfn_private;
+	log->logfn_private = logfn_private;
 
 	if (pipe(p) != 0) {
-		DEBUG(DEBUG_ERR,(__location__ " Failed to setup for child logging pipe\n"));
+		DEBUG(DEBUG_ERR, (__location__ " Failed to setup pipe for child logging\n"));
+		goto free_log;
+	}
+
+	argv = talloc_array(mem_ctx, char *, helper_argc + 2);
+	if (argv == NULL) {
+		DEBUG(DEBUG_ERR, (__location__ "Failed to allocate memory for helper\n"));
+		goto free_log;
+	}
+	argv[0] = discard_const(helper);
+	argv[1] = talloc_asprintf(argv, "%d", p[1]);
+	if (argv[1] == NULL) {
+		DEBUG(DEBUG_ERR, (__location__ "Failed to allocate memory for helper\n"));
+		talloc_free(argv);
 		goto free_log;
 	}
 
-	*pid = ctdb_fork(ctdb);
+	for (i=0; i<helper_argc; i++) {
+		argv[i+2] = discard_const(helper_argv[i]);
+	}
 
-	/* Child? */
+	*pid = vfork();
 	if (*pid == 0) {
-		close(STDOUT_FILENO);
-		close(STDERR_FILENO);
-		dup2(p[1], STDOUT_FILENO);
-		dup2(p[1], STDERR_FILENO);
-		close(p[0]);
-		close(p[1]);
-		return log;
+		execv(helper, argv);
+		_exit(1);
 	}
 	close(p[1]);
 
-	/* We failed? */
 	if (*pid < 0) {
-		DEBUG(DEBUG_ERR, (__location__ " fork failed for child process\n"));
+		DEBUG(DEBUG_ERR, (__location__ "vfork failed for helper process\n"));
 		close(p[0]);
 		goto free_log;
 	}
 
+	ctdb_track_child(ctdb, *pid);
+
 	log->pfd = p[0];
 	set_close_on_exec(log->pfd);
 	talloc_set_destructor(log, log_context_destructor);
-	fde = event_add_fd(ctdb->ev, log, log->pfd,
-			   EVENT_FD_READ, ctdb_log_handler, log);
+	fde = tevent_add_fd(ctdb->ev, log, log->pfd, EVENT_FD_READ,
+			    ctdb_log_handler, log);
 	tevent_fd_set_auto_close(fde);
 
 	return log;
@@ -528,6 +545,7 @@ free_log:
 	return NULL;
 }
 
+
 /*
   setup for logging of child process stdout
 */
diff --git a/server/ctdb_monitor.c b/server/ctdb_monitor.c
index acd68c8..2b52fd0 100644
--- a/server/ctdb_monitor.c
+++ b/server/ctdb_monitor.c
@@ -337,7 +337,7 @@ static void ctdb_check_health(struct event_context *ev, struct timed_event *te,
 		DEBUG(DEBUG_NOTICE,("Recoveries finished. Running the \"startup\" event.\n"));
 		ret = ctdb_event_script_callback(ctdb, 
 						 ctdb->monitor->monitor_context, ctdb_startup_callback, 
-						 ctdb, false,
+						 ctdb,
 						 CTDB_EVENT_STARTUP, "%s", "");
 	} else {
 		int i;
@@ -362,7 +362,7 @@ static void ctdb_check_health(struct event_context *ev, struct timed_event *te,
 		} else {
 			ret = ctdb_event_script_callback(ctdb, 
 					ctdb->monitor->monitor_context, ctdb_health_callback,
-					ctdb, false,
+					ctdb,
 					CTDB_EVENT_MONITOR, "%s", "");
 		}
 	}
diff --git a/server/ctdb_recover.c b/server/ctdb_recover.c
index 414f5b1..7249f50 100644
--- a/server/ctdb_recover.c
+++ b/server/ctdb_recover.c
@@ -944,7 +944,6 @@ int32_t ctdb_control_end_recovery(struct ctdb_context *ctdb,
 	ret = ctdb_event_script_callback(ctdb, state,
 					 ctdb_end_recovery_callback, 
 					 state, 
-					 false,
 					 CTDB_EVENT_RECOVERED, "%s", "");
 
 	if (ret != 0) {
@@ -998,7 +997,7 @@ int32_t ctdb_control_start_recovery(struct ctdb_context *ctdb,
 
 	ret = ctdb_event_script_callback(ctdb, state,
 					 ctdb_start_recovery_callback, 
-					 state, false,
+					 state,
 					 CTDB_EVENT_START_RECOVERY,
 					 "%s", "");
 
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index 04cdd66..0d859f9 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -510,7 +510,6 @@ static int32_t ctdb_do_takeip(struct ctdb_context *ctdb,
 					 state,
 					 ctdb_do_takeip_callback,
 					 state,
-					 false,
 					 CTDB_EVENT_TAKE_IP,
 					 "%s %s %u",
 					 ctdb_vnn_iface_string(vnn),
@@ -651,7 +650,6 @@ static int32_t ctdb_do_updateip(struct ctdb_context *ctdb,
 					 state,
 					 ctdb_do_updateip_callback,
 					 state,
-					 false,
 					 CTDB_EVENT_UPDATE_IP,
 					 "%s %s %s %u",
 					 state->old->name,
@@ -1024,7 +1022,6 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
 
 	ret = ctdb_event_script_callback(ctdb, 
 					 state, release_ip_callback, state,
-					 false,
 					 CTDB_EVENT_RELEASE_IP,
 					 "%s %s %u",
 					 iface,
@@ -4192,7 +4189,6 @@ int32_t ctdb_control_del_public_address(struct ctdb_context *ctdb, TDB_DATA inda
 
 			ret = ctdb_event_script_callback(ctdb, 
 					 mem_ctx, delete_ip_callback, mem_ctx,
-					 false,
 					 CTDB_EVENT_RELEASE_IP,
 					 "%s %s %u",
 					 ctdb_vnn_iface_string(vnn),
@@ -4250,7 +4246,7 @@ int32_t ctdb_control_ipreallocated(struct ctdb_context *ctdb,
 
 	ret = ctdb_event_script_callback(ctdb, state,
 					 ctdb_ipreallocated_callback, state,
-					 false, CTDB_EVENT_IPREALLOCATED,
+					 CTDB_EVENT_IPREALLOCATED,
 					 "%s", "");
 
 	if (ret != 0) {
diff --git a/server/eventscript.c b/server/eventscript.c
index d13e944..0feb32b 100644
--- a/server/eventscript.c
+++ b/server/eventscript.c
@@ -29,23 +29,6 @@
 
 static void ctdb_event_script_timeout(struct event_context *ev, struct timed_event *te, struct timeval t, void *p);
 
-/*
-  ctdbd sends us a SIGTERM when we should die.
- */
-static void sigterm(int sig)
-{
-	pid_t pid;
-
-	/* all the child processes will be running in the same process group */
-	pid = getpgrp();
-	if (pid == -1) {
-		kill(-getpid(), SIGKILL);
-	} else {
-		kill(-pid, SIGKILL);
-	}
-	_exit(1);
-}
-
 /* This is attached to the event script state. */
 struct event_script_callback {
 	struct event_script_callback *next, *prev;
@@ -62,7 +45,6 @@ struct ctdb_event_script_state {
 	struct event_script_callback *callback;
 	pid_t child;
 	int fd[2];
-	bool from_user;
 	enum ctdb_eventscript_call call;
 	const char *options;
 	struct timeval timeout;
@@ -267,122 +249,92 @@ static struct ctdb_scripts_wire *ctdb_get_script_list(struct ctdb_context *ctdb,
 	return scripts;
 }


-- 
CTDB repository


More information about the samba-cvs mailing list