1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/ctdb
Martin Schwenke 4697829e7c 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@meltin.net>

(This used to be ctdb commit c97d56d93d9c1007a4e85affb19ed0c2d0e11b6d)
2009-06-19 12:12:39 +10:00
..
client Whitespace changes and using the CTDB_NO_MEMORY() macro changes to 2009-05-21 11:49:16 +10:00
common change the socket we use for sending grautious ARPs from AF_INET/SOCK_PACKET to AF_PACKET/SOCK_RAW 2009-05-21 14:10:45 +10:00
config Merge branch 'init_rewrite' 2009-06-02 16:40:01 +10:00
doc idocument how to remove a node from an existing cluster using 'ctdb 2009-06-02 12:43:11 +10:00
ib Whitespace changes and using the CTDB_NO_MEMORY() macro changes to 2009-05-21 11:49:16 +10:00
include add a new node state : DELETED. 2009-06-01 14:18:34 +10:00
lib New attempt at TDB transaction nesting allow/disallow. 2009-05-25 17:04:42 +10:00
packaging new version 1.0.84 2009-06-02 15:05:41 +10:00
server When we ban a node, only drop the IPs on the node being banned, not on every node 2009-06-10 10:35:20 +10:00
tcp add a new node state : DELETED. 2009-06-01 14:18:34 +10:00
tests Clean up handling the of CTDB restarts in testcases. 2009-06-19 11:40:09 +10:00
tools Fix minor onnode bugs relating to local daemons. 2009-06-19 12:12:39 +10:00
utils From William Jojo <w.jojo[AT]hvcc.edu> 2009-06-04 09:41:05 +10:00
web fix the git path to the repository 2009-05-25 12:15:13 +10:00
.bzrignore more code rearrangement 2007-06-07 22:16:48 +10:00
.gitignore From Mathieu Parent <math.parent@gmail.com> 2009-04-08 09:21:11 +10:00
aclocal.m4 initial version 2006-11-18 10:41:20 +11:00
autogen.sh From Mathieu Parent <math.parent@gmail.com> 2009-04-08 09:21:11 +10:00
config.guess more merges for GPLv3 update 2007-07-10 15:46:05 +10:00
config.mk minor back-merge from samba4 2007-07-10 18:13:47 +10:00
config.sub more merges for GPLv3 update 2007-07-10 15:46:05 +10:00
configure.ac remove the obsolete ipmux component. 2009-05-25 12:33:52 +10:00
configure.rpm fixed permissions on configure.rpm 2008-04-22 16:48:25 +02:00
COPYING add a licence file 2009-02-07 08:10:34 +11:00
ctdb.pc.in (This used to be ctdb commit b0718551f55d5da9be0e6aba233f57c1ff8509be) 2009-04-08 09:14:20 +10:00
install-sh initial version 2006-11-18 10:41:20 +11:00
Makefile.in remove the obsolete ipmux component. 2009-05-25 12:33:52 +10:00