[SCM] CTDB repository - branch master updated - ctdb-1.0.84-19-g5d32009

Ronnie Sahlberg sahlberg at samba.org
Fri Jun 19 08:02:34 GMT 2009


The branch, master has been updated
       via  5d320099025b6835eda3a1e431708f7e0a6b0ba6 (commit)
      from  fdf50f3e774e3980af81c0b6f4ff81d085f4f697 (commit)

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


- Log -----------------------------------------------------------------
commit 5d320099025b6835eda3a1e431708f7e0a6b0ba6
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Jun 19 12:12:39 2009 +1000

    Fix minor onnode bugs relating to local daemons.
    
    Commit a0f5148ac749758e2dfbd6099e829c5bf1d900e6 caused a subtle
    regression.  Due to the subtlety, this description is much longer than
    the 1 line patch that fixes it!  The regression, where a process that
    invokes onnode is unexpectedly blocked, is only apparent if the
    following conditions are met:
    
    1. $CTDB_NODES_SOCKETS is set;
    2. The command passed to onnode attempts to background a process; and
    3. onnode is run in certain types of subshell (e.g. foo=$(onnode ...)).
    
    In particular, when testing against local daemons (i.e. condition (1)
    is met), tests/simple/07_ctdb_process_exists.sh would fail (because it
    does both (2), (3)).
    
    The problem is caused by the use of file descriptor 3 in the code that
    allows separate filtering of stdout and stderr.  A backgrounded
    process will have this descriptor open and the $(...) construct
    appears to wait for all file descriptors to be closed.  This only
    happens with local daemons because SSH is replaced by a shell and file
    descriptor 3 leaks into that shell.  It does not occur when SSH is
    used because the file descriptor does not leak into the remote shell
    where the process is backgrounded.
    
    The fix is simply to redirect file descriptor 3 to /dev/null in the
    fakessh function, which is used when $CTDB_NODES_SOCKETS is set.
    
    Also fixed is another minor bug when the -o option and
    $CTDB_NODES_SOCKETS are used in combination.  The code uses the node
    name as a suffix for the output filename(s).  Usually this is an IP
    address.  However, when $CTDB_NODES_SOCKETS is in use the node name is
    the socket name, which might be a path several directories deep.
    Each output file is created via a simple redirection and this would
    fail if unexpected directories appear in the filename.  3 possible
    fixes were considered:
    
    1. Replace all '/'s in the node name by '_'s.  Nice and simple.
    2. Use the basename of the node name.  However, sockets may be in
       different directories but have the same basename.
    3. Create all required directories before redirecting.  This is a
       little more complex and probably doesn't meet the user's
       expectations.
    
    Option (1) is implemented here.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

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

Summary of changes:
 tools/onnode |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/tools/onnode b/tools/onnode
index aae7770..b5f36c8 100755
--- a/tools/onnode
+++ b/tools/onnode
@@ -241,13 +241,13 @@ get_nodes ()
 
 fakessh ()
 {
-    CTDB_SOCKET="$1" sh -c "$2"
+    CTDB_SOCKET="$1" sh -c "$2" 3>/dev/null
 }
 
 stdout_filter ()
 {
     if [ -n "$prefix" ] ; then
-	cat >"${prefix}.${n}"
+	cat >"${prefix}.${n//\//_}"
     elif $verbose && $parallel ; then
 	sed -e "s@^@[$n] @"
     else


-- 
CTDB repository


More information about the samba-cvs mailing list