[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Thu Jan 8 20:26:03 MST 2015


The branch, master has been updated
       via  a59fb32 ctdb: improve helpfulness of debug message when taking reclock fails
       via  6f1ac7a ctdb-daemon: Handle out-of-memory when setting recovery lock file
       via  4638010 ctdb-scripts: Don't use the GNU awk gensub() function
       via  a5c5eee ctdb-scripts: Try to deal with Ubuntu having /usr/sbin/service
       via  82aa6bd ctdb-tests: Fix tickle sniffing for IPv4
       via  2c3672f ctdb-scripts: Fix bashism in ctdbd_wrapper script
      from  115eb94 wafadmin: backported the openbsd fixes from waf 1.7

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a59fb322d60b7152110cc0638dd9b76dd259ac15
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 9 00:10:37 2015 +0100

    ctdb: improve helpfulness of debug message when taking reclock fails
    
    Print out the errno if the fcntl call.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Richard Sharpe <rsharpe at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Fri Jan  9 04:25:02 CET 2015 on sn-devel-104

commit 6f1ac7af0f87d85402d708231e45a69713bba026
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Dec 9 13:40:23 2014 +1100

    ctdb-daemon: Handle out-of-memory when setting recovery lock file
    
    Log a message when the reclock file actually changes and avoid a
    memory allocation when it doesn't change.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 4638010abb116aed0c180207aaa11475277aecb7
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Dec 19 14:19:32 2014 +1100

    ctdb-scripts: Don't use the GNU awk gensub() function
    
    This is a gawk extension and can't be used reliably if just running
    "awk".  It is simple enough to switch to using the standard sub() and
    gsub() functions.
    
    The alternative is to switch to explicitly running "gawk".  However,
    although the eventscripts aren't exactly portable, it is probably
    better to move closer to portability than further away.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit a5c5eee7d186d938c5b458cb6dbf0c78cb548b63
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Dec 1 12:21:16 2014 +1100

    ctdb-scripts: Try to deal with Ubuntu having /usr/sbin/service
    
    Falling back to running the initscript doesn't work because it detects
    that upstart is being used and fails.  This was observed when trying
    to start winbind on Ubuntu 11.04.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 82aa6bd2f27775f3fd82931d613379d5d618ef70
Author: Martin Schwenke <martin at meltin.net>
Date:   Sat Dec 20 19:54:13 2014 +1100

    ctdb-tests: Fix tickle sniffing for IPv4
    
    tcptickle_sniff_start() assumes that if $dst contains a ': then it
    should use the IPv6 sniffing code.  However, $dst is a socket, so has
    a trailing ":<port>".
    
    Strip the trailing ":<port>" before checking for ':' as a marker for
    an IPv6 address.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 2c3672f4249a7d3453b7e82ca96b4cd666aae709
Author: Led <ledest at gmail.com>
Date:   Sun Dec 14 21:06:44 2014 +0200

    ctdb-scripts: Fix bashism in ctdbd_wrapper script
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11007
    
    Signed-off-by: Oleksandr Chumachenko <ledest at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Michael Adam <obnox at samba.org>

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

Summary of changes:
 ctdb/config/ctdbd_wrapper               |  2 +-
 ctdb/config/functions                   |  9 ++++++---
 ctdb/config/statd-callout               |  4 +++-
 ctdb/server/ctdb_control.c              | 34 +++++++++++++++++++++++++--------
 ctdb/server/ctdb_recover.c              |  6 +++++-
 ctdb/tests/complex/18_ctdb_reloadips.sh |  2 +-
 ctdb/tests/complex/scripts/local.bash   |  2 +-
 ctdb/tests/scripts/integration.bash     |  5 +++--
 8 files changed, 46 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/config/ctdbd_wrapper b/ctdb/config/ctdbd_wrapper
index 9159b27..f50efe9 100755
--- a/ctdb/config/ctdbd_wrapper
+++ b/ctdb/config/ctdbd_wrapper
@@ -154,7 +154,7 @@ kill_ctdbd ()
 start()
 {
     if _session=$(ctdbd_is_running) ; then
-	echo $"CTDB is already running"
+	echo "CTDB is already running"
 	return 0
     fi
 
diff --git a/ctdb/config/functions b/ctdb/config/functions
index 23cb236..3bc9e3d 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -171,6 +171,8 @@ _service ()
 
   if [ -x /sbin/service ]; then
       $_nice /sbin/service "$_service_name" "$_op"
+  elif [ -x /usr/sbin/service ]; then
+      $_nice /usr/sbin/service "$_service_name" "$_op"
   elif [ -x $CTDB_ETCDIR/init.d/$_service_name ]; then
       $_nice $CTDB_ETCDIR/init.d/$_service_name "$_op"
   elif [ -x $CTDB_ETCDIR/rc.d/init.d/$_service_name ]; then
@@ -913,7 +915,7 @@ delete_ip_from_iface()
     }
 }
 
-# If the given IP is hosted then print 2 items: maskbits and iface 
+# If the given IP is hosted then print 2 items: maskbits and iface
 ip_maskbits_iface ()
 {
     _addr="$1"
@@ -925,8 +927,9 @@ ip_maskbits_iface ()
 
     ip addr show to "${_addr}/${_bits}" 2>/dev/null | \
 	awk -v family="${_family}" \
-	    'NR == 1 { iface = gensub(":$", "", 1, $2) } \
-             $1 ~ /inet/ { print gensub(".*/", "", 1, $2), iface, family }'
+	    'NR == 1 { iface = $2; sub(":$", "", iface) } \
+             $1 ~ /inet/ { mask = $2; sub(".*/", "", mask); \
+                           print mask, iface, family }'
 }
 
 drop_ip ()
diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout
index 5e8eb0e..e2a955e 100755
--- a/ctdb/config/statd-callout
+++ b/ctdb/config/statd-callout
@@ -145,7 +145,9 @@ case "$1" in
 	#   server-IP client-IP
 	# but only for the server-IPs that are hosted on this node.
 	sed_expr=$(ctdb ip | tail -n +2 |
-	    awk -v pnn=$pnn 'pnn == $2 { printf "s/^key.*=.*statd-state@\\(%s\\)@\\([^\"]*\\).*/\\1 \\2/p\n", gensub(/\./, "\\\\.", "g", $1) }')
+	    awk -v pnn=$pnn 'pnn == $2 { \
+                ip = $1; gsub(/\./, "\\\\.", ip); \
+                printf "s/^key.*=.*statd-state@\\(%s\\)@\\([^\"]*\\).*/\\1 \\2/p\n", ip }')
 
 	statd_state=$(ctdb catdb ctdb.tdb | sed -n "$sed_expr" | sort)
 	[ -n "$statd_state" ] || exit 0
diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c
index 49bc986..9d835e8 100644
--- a/ctdb/server/ctdb_control.c
+++ b/ctdb/server/ctdb_control.c
@@ -519,17 +519,35 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 			outdata->dsize = strlen(ctdb->recovery_lock_file) + 1;
 		}
 		return 0;
-	case CTDB_CONTROL_SET_RECLOCK_FILE:
-		ctdb->tunable.verify_recovery_lock = 0;
-		if (ctdb->recovery_lock_file != NULL) {
-			talloc_free(ctdb->recovery_lock_file);
-			ctdb->recovery_lock_file = NULL;
+	case CTDB_CONTROL_SET_RECLOCK_FILE: {
+		char *t;
+
+		if (indata.dsize == 0) {
+			TALLOC_FREE(ctdb->recovery_lock_file);
+			return 0;
+		}
+
+		/* Return silent success if unchanged.  Recovery
+		 * master updates all nodes on each recovery - we
+		 * don't need the extra memory allocation or log
+		 * message each time. */
+		if (strcmp(discard_const(indata.dptr),
+			   ctdb->recovery_lock_file) == 0) {
+			return 0;
 		}
-		if (indata.dsize > 0) {
-			ctdb->recovery_lock_file = talloc_strdup(ctdb, discard_const(indata.dptr));
-			ctdb->tunable.verify_recovery_lock = 1;
+
+		t = talloc_strdup(ctdb, discard_const(indata.dptr));
+		if (t == NULL) {
+			DEBUG(DEBUG_ERR, ("Out of memory in SET_RECLOCK_FILE\n"));
+			return -1;
 		}
+
+		talloc_free(ctdb->recovery_lock_file);
+		ctdb->recovery_lock_file = t;
+		DEBUG(DEBUG_NOTICE, ("Updated recovery lock file to %s\n", t));
+
 		return 0;
+	}
 
 	case CTDB_CONTROL_STOP_NODE:
 		CHECK_CONTROL_DATA_SIZE(0);
diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c
index c26a048..10d088b 100644
--- a/ctdb/server/ctdb_recover.c
+++ b/ctdb/server/ctdb_recover.c
@@ -753,10 +753,14 @@ bool ctdb_recovery_lock(struct ctdb_context *ctdb, bool keep)
 	lock.l_pid = 0;
 
 	if (fcntl(ctdb->recovery_lock_fd, F_SETLK, &lock) != 0) {
+		int saved_errno = errno;
 		close(ctdb->recovery_lock_fd);
 		ctdb->recovery_lock_fd = -1;
 		if (keep) {
-			DEBUG(DEBUG_CRIT,("ctdb_recovery_lock: Failed to get recovery lock on '%s'\n", ctdb->recovery_lock_file));
+			DEBUG(DEBUG_CRIT,("ctdb_recovery_lock: Failed to get "
+					  "recovery lock on '%s' - (%s)\n",
+					  ctdb->recovery_lock_file,
+					  strerror(saved_errno)));
 		}
 		return false;
 	}
diff --git a/ctdb/tests/complex/18_ctdb_reloadips.sh b/ctdb/tests/complex/18_ctdb_reloadips.sh
index 13f7c21..71f997c 100755
--- a/ctdb/tests/complex/18_ctdb_reloadips.sh
+++ b/ctdb/tests/complex/18_ctdb_reloadips.sh
@@ -56,7 +56,7 @@ ctdb_ip_info=$(echo "$out" | awk -F'|' 'NR > 1 { print $2, $3, $5 }')
 echo "Getting IP information from interfaces..."
 try_command_on_node all "ip addr show"
 ip_addr_info=$(echo "$out" | \
-    awk '$1 == "inet" { print gensub(/\/.*/, "", "", $2)}')
+    awk '$1 == "inet" { ip = $2; sub(/\/.*/, "", ip); print ip }')
 
 prefix=""
 for b in $(seq 0 255) ; do
diff --git a/ctdb/tests/complex/scripts/local.bash b/ctdb/tests/complex/scripts/local.bash
index 9c41af2..2dd62a8 100644
--- a/ctdb/tests/complex/scripts/local.bash
+++ b/ctdb/tests/complex/scripts/local.bash
@@ -185,7 +185,7 @@ tcptickle_sniff_start ()
     local src="$1"
     local dst="$2"
 
-    case "$dst" in
+    case "${dst%:*}" in
 	*:*) tcp6tickle_sniff_start "$src" "$dst" ;;
 	*)   tcp4tickle_sniff_start "$src" "$dst" ;;
     esac
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index 0d27c93..139a9a2 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -699,8 +699,9 @@ ip_maskbits_iface ()
 
     ip addr show to "${_addr}/${_bits}" 2>/dev/null | \
 	awk -v family="${_family}" \
-	    'NR == 1 { iface = gensub(":$", "", 1, $2) } \
-             $1 ~ /inet/ { print gensub(".*/", "", 1, $2), iface, family }'
+	    'NR == 1 { iface = $2; sub(":$", "", iface) } \
+             $1 ~ /inet/ { mask = $2; sub(".*/", "", mask); \
+                           print mask, iface, family }'
 }
 
 drop_ip ()


-- 
Samba Shared Repository


More information about the samba-cvs mailing list