[SCM] CTDB repository - branch master updated - ctdb-1.0.111-11-g4bcb07c
Ronnie Sahlberg
sahlberg at samba.org
Tue Jan 12 13:04:36 MST 2010
The branch, master has been updated
via 4bcb07c412260147cd926452287885d05b2344c1 (commit)
via 4cc9c79bfced9efa0d3817021512c86ed2fa3516 (commit)
via 608e0765130aa9bca0aa77db5a888c413867a3fd (commit)
via acb98c36a3d56fa6b34747015b913ada3eaa133f (commit)
via 64ae8b0702cfdc44a778e0cc3705dd685f9f6ab0 (commit)
via b70021856e76df1ba407c83cfc19bf332fbfc869 (commit)
via 178f429a7b6d1008d35e857b6ca1df6adb60d255 (commit)
via bb9fc8b4388848863fa2b8735bd77eb07b7b5849 (commit)
via 82e1c5231c389bea935328a08ecf9b0b3a3979ef (commit)
via d9105ea79df198a20c2bfe471c4793d1dbba886e (commit)
via f319bd54369a2bc7d32c3bda7fc22f2ef1a51c3a (commit)
from 484ae893f2179bebd0e2a2efe5f9619a39e48227 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 4bcb07c412260147cd926452287885d05b2344c1
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jan 13 07:12:08 2010 +1100
new version 1.0.113
commit 4cc9c79bfced9efa0d3817021512c86ed2fa3516
Merge: 64ae8b0702cfdc44a778e0cc3705dd685f9f6ab0 608e0765130aa9bca0aa77db5a888c413867a3fd
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jan 13 07:01:40 2010 +1100
Merge commit 'metze/master-for-ronnie'
commit 608e0765130aa9bca0aa77db5a888c413867a3fd
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Jan 7 13:29:09 2010 +0100
server: call event_add_fd at the end of ctdb_set_child_logging()
metze
commit acb98c36a3d56fa6b34747015b913ada3eaa133f
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Jan 7 13:47:46 2010 +0100
ctdb_logging: simplify ctdb_fork_with_logging a lot and reduce the syscall usage
metze
commit 64ae8b0702cfdc44a778e0cc3705dd685f9f6ab0
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Jan 12 21:07:45 2010 +1100
New version 1.0.112.
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit b70021856e76df1ba407c83cfc19bf332fbfc869
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Jan 12 21:02:44 2010 +1100
Revert "Use wbinfo --ping-dc isntead of wbingo -p sicne this is a more reliable way to determine if winbindd is in a useful state."
This reverts commit 7c95e56ba871a4e0cb893a5cb5d821e7ff6e6dd6.
wbinfo --ping-dc is proving too unreliable.
commit 178f429a7b6d1008d35e857b6ca1df6adb60d255
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Jan 12 21:02:11 2010 +1100
Revert "events/50.samba: only use wbinfo --ping-dc if available"
This reverts commit 7b73834ba3ac197cc8a3020c111f9bb2c567e70b.
wbinfo --ping-dc is proving too unreliable.
commit bb9fc8b4388848863fa2b8735bd77eb07b7b5849
Merge: 82e1c5231c389bea935328a08ecf9b0b3a3979ef 484ae893f2179bebd0e2a2efe5f9619a39e48227
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Jan 7 12:46:26 2010 +1100
Merge commit 'origin/master'
commit 82e1c5231c389bea935328a08ecf9b0b3a3979ef
Merge: d9105ea79df198a20c2bfe471c4793d1dbba886e 859e18db681dabe0990793d03f58e59a061aa8bb
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Dec 18 14:44:25 2009 +1100
Merge commit 'origin/master'
commit d9105ea79df198a20c2bfe471c4793d1dbba886e
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Dec 18 14:43:45 2009 +1100
Test suite: Add an optimisation in the getvar test.
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit f319bd54369a2bc7d32c3bda7fc22f2ef1a51c3a
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Dec 18 14:42:58 2009 +1100
Test suite: allow settign of timeout triggers for all events not just monitor.
Signed-off-by: Martin Schwenke <martin at meltin.net>
-----------------------------------------------------------------------
Summary of changes:
config/events.d/50.samba | 7 +---
packaging/RPM/ctdb.spec.in | 7 +++-
server/ctdb_logging.c | 77 ++++++++++++++------------------
tests/scripts/ctdb_test_functions.bash | 45 ++++++++++++++-----
tests/simple/03_ctdb_getvar.sh | 2 +-
5 files changed, 76 insertions(+), 62 deletions(-)
Changeset truncated at 500 lines:
diff --git a/config/events.d/50.samba b/config/events.d/50.samba
index 8147f6e..5c10b19 100755
--- a/config/events.d/50.samba
+++ b/config/events.d/50.samba
@@ -247,12 +247,7 @@ case "$1" in
# check winbind is OK
check_ctdb_manages_winbind
[ "$CTDB_MANAGES_WINBIND" = "yes" ] && {
- TMP_PING_DC=`wbinfo --help |grep '\-\-ping\-dc' |wc -l`
- if test x"$TMP_PING_DC" = x"1"; then
- ctdb_check_command "winbind" "wbinfo --ping-dc"
- else
- ctdb_check_command "winbind" "wbinfo --ping"
- fi
+ ctdb_check_command "winbind" "wbinfo -p"
}
;;
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 58527d7..9101f80 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -4,7 +4,7 @@ Summary: Clustered TDB
Vendor: Samba Team
Packager: Samba Team <samba at samba.org>
Name: ctdb
-Version: 1.0.111
+Version: 1.0.113
Release: 1GITHASH
Epoch: 0
License: GNU GPL version 3
@@ -123,6 +123,11 @@ rm -rf $RPM_BUILD_ROOT
%{_docdir}/ctdb/tests/bin/ctdb_transaction
%changelog
+* Wed Jan 13 2010 : Version 1.0.113
+ - Incorrect use of dup2() could cause ctdb to spin eating 100% cpu.
+* Tue Jan 12 2010 : Version 1.0.112
+ - Revert the use of wbinfo --ping-dc as it is proving too unreliable.
+ - Minor testsuite changes.
* Fri Dec 18 2009 : Version 1.0.111
- Fix a logging bug when an eventscript is aborted that could cause a crash.
- Add back cb_status that was lost in a previous commit.
diff --git a/server/ctdb_logging.c b/server/ctdb_logging.c
index 22baea4..56dcfa2 100644
--- a/server/ctdb_logging.c
+++ b/server/ctdb_logging.c
@@ -433,8 +433,6 @@ struct ctdb_log_state *ctdb_fork_with_logging(TALLOC_CTX *mem_ctx,
void *logfn_private, pid_t *pid)
{
int p[2];
- int old_stdout, old_stderr;
- int saved_errno;
struct ctdb_log_state *log;
log = talloc_zero(mem_ctx, struct ctdb_log_state);
@@ -448,36 +446,24 @@ struct ctdb_log_state *ctdb_fork_with_logging(TALLOC_CTX *mem_ctx,
goto free_log;
}
- /* We'll fail if stderr/stdout not already open; it's simpler. */
- old_stdout = dup(STDOUT_FILENO);
- old_stderr = dup(STDERR_FILENO);
- if (dup2(p[1], STDOUT_FILENO) < 0 || dup2(p[1], STDERR_FILENO) < 0) {
- DEBUG(DEBUG_ERR,(__location__ " Failed to setup output for child\n"));
- goto close_pipe;
- }
- close(p[1]);
-
*pid = fork();
/* Child? */
if (*pid == 0) {
- close(old_stdout);
- close(old_stderr);
+ close(STDOUT_FILENO);
+ close(STDERR_FILENO);
+ dup2(p[1], STDOUT_FILENO);
+ dup2(p[1], STDERR_FILENO);
close(p[0]);
+ close(p[1]);
return log;
}
-
- saved_errno = errno;
- dup2(STDOUT_FILENO, old_stdout);
- dup2(STDERR_FILENO, old_stderr);
- close(old_stdout);
- close(old_stderr);
+ close(p[1]);
/* We failed? */
if (*pid < 0) {
DEBUG(DEBUG_ERR, (__location__ " fork failed for child process\n"));
close(p[0]);
- errno = saved_errno;
goto free_log;
}
@@ -489,9 +475,6 @@ struct ctdb_log_state *ctdb_fork_with_logging(TALLOC_CTX *mem_ctx,
ctdb_log_handler, log);
return log;
-close_pipe:
- close(p[0]);
- close(p[1]);
free_log:
talloc_free(log);
return NULL;
@@ -503,9 +486,9 @@ free_log:
int ctdb_set_child_logging(struct ctdb_context *ctdb)
{
int p[2];
- int ret;
+ int old_stdout, old_stderr;
- if (ctdb->log->fd == 1) {
+ if (ctdb->log->fd == STDOUT_FILENO) {
/* not needed for stdout logging */
return 0;
}
@@ -516,31 +499,39 @@ int ctdb_set_child_logging(struct ctdb_context *ctdb)
return -1;
}
+ /* We'll fail if stderr/stdout not already open; it's simpler. */
+ old_stdout = dup(STDOUT_FILENO);
+ old_stderr = dup(STDERR_FILENO);
+ if (dup2(p[1], STDOUT_FILENO) < 0 || dup2(p[1], STDERR_FILENO) < 0) {
+ int saved_errno = errno;
+ dup2(old_stdout, STDOUT_FILENO);
+ dup2(old_stderr, STDERR_FILENO);
+ close(old_stdout);
+ close(old_stderr);
+ close(p[0]);
+ close(p[1]);
+ errno = saved_errno;
+
+ printf(__location__ " dup2 failed: %s\n",
+ strerror(errno));
+ return -1;
+ }
+ close(p[1]);
+ close(old_stdout);
+ close(old_stderr);
+
+ /* Is this correct for STDOUT and STDERR ? */
+ set_close_on_exec(STDOUT_FILENO);
+ set_close_on_exec(STDERR_FILENO);
+ set_close_on_exec(p[0]);
+
event_add_fd(ctdb->ev, ctdb->log, p[0],
EVENT_FD_READ | EVENT_FD_AUTOCLOSE,
ctdb_log_handler, ctdb->log);
- set_close_on_exec(p[0]);
ctdb->log->pfd = p[0];
DEBUG(DEBUG_NOTICE, (__location__ " Created PIPE FD:%d for logging\n", p[0]));
- close(1);
- close(2);
- if (p[1] != 1) {
- ret = dup2(p[1], 1);
- if (ret == -1) {
- printf("dup2 failed: %s\n", strerror(errno));
- return -1;
- }
- close(p[1]);
- }
- /* also catch stderr of subcommands to the log */
- ret = dup2(1, 2);
- if (ret == -1) {
- printf("dup2 failed: %s\n", strerror(errno));
- return -1;
- }
-
return 0;
}
diff --git a/tests/scripts/ctdb_test_functions.bash b/tests/scripts/ctdb_test_functions.bash
index d8a0de9..7c1b46c 100644
--- a/tests/scripts/ctdb_test_functions.bash
+++ b/tests/scripts/ctdb_test_functions.bash
@@ -937,6 +937,17 @@ ctdb_test_eventscript_unhealthy_detected ()
ctdb_test_eventscript_file_${cmd} "$pnn" "unhealthy-detected"
}
+# Handle a trigger that causes 99.ctdb_test to timeout it's monitor
+# event. This should cause the node to be banned.
+ctdb_test_eventscript_timeout_trigger ()
+{
+ local cmd="$1"
+ local pnn="$2"
+ local event="$3"
+
+ ctdb_test_eventscript_file_${cmd} "$pnn" "${event}-timeout"
+}
+
# Note that the eventscript can't use the above functions!
ctdb_test_eventscript_install ()
{
@@ -949,16 +960,28 @@ rm -vf "/tmp/ctdb-test-flag-${1}.${pnn}"
trigger="/tmp/ctdb-test-unhealthy-trigger.${pnn}"
detected="/tmp/ctdb-test-unhealthy-detected.${pnn}"
-if [ "$1" = "monitor" ] ; then
- if [ -e "$trigger" ] ; then
- echo "${0}: Unhealthy because \"$trigger\" detected"
- touch "$detected"
- exit 1
- elif [ -e "$detected" -a ! -e "$trigger" ] ; then
- echo "${0}: Healthy again, \"$trigger\" no longer detected"
- rm "$detected"
- fi
-fi
+timeout_trigger="/tmp/ctdb-test-${1}-timeout.${pnn}"
+case "$1" in
+ monitor)
+ if [ -e "$trigger" ] ; then
+ echo "${0}: Unhealthy because \"$trigger\" detected"
+ touch "$detected"
+ exit 1
+ elif [ -e "$detected" -a ! -e "$trigger" ] ; then
+ echo "${0}: Healthy again, \"$trigger\" no longer detected"
+ rm "$detected"
+ fi
+
+ ;;
+ *)
+ if [ -e "$timeout_trigger" ] ; then
+ echo "${0}: Sleeping for a long time because \"$timeout_trigger\" detected"
+ sleep 9999
+ fi
+ ;;
+ *)
+
+esac
exit 0
'
@@ -976,7 +999,7 @@ wait_for_monitor_event ()
{
local pnn="$1"
- echo "Waiting for a monitor event on node $pnn to complete..."
+ echo "Waiting for a monitor event on node ${pnn}..."
ctdb_test_eventscript_flag create $pnn "monitor"
wait_until 120 ! ctdb_test_eventscript_flag exists $pnn "monitor"
diff --git a/tests/simple/03_ctdb_getvar.sh b/tests/simple/03_ctdb_getvar.sh
index 197df99..748e329 100755
--- a/tests/simple/03_ctdb_getvar.sh
+++ b/tests/simple/03_ctdb_getvar.sh
@@ -42,7 +42,7 @@ echo "$out" |
while read var x val ; do
try_command_on_node 0 "$CTDB getvar $var"
- val2=$(echo $out | sed -e 's at .*[[:space:]]@@')
+ val2="${out#*= }"
if [ "$val" != "$val2" ] ; then
echo "MISMATCH on $var: $val != $val2"
--
CTDB repository
More information about the samba-cvs
mailing list