From ee747b5bd6ae487e0cfcf091cbed614bfe6890fe Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 5 Jun 2007 15:18:37 +1000 Subject: [PATCH] set close on exec on pipe in event scripts, so long running scripts don't hold the pipe (This used to be ctdb commit 22662614b4091a4e4282e63d6876097cbf3e3d6e) --- ctdb/config/ctdb.sysconfig | 5 +++++ ctdb/config/events.d/50.samba | 4 ++++ ctdb/config/events.d/59.nfslock | 2 ++ ctdb/config/events.d/60.nfs | 2 ++ ctdb/takeover/system.c | 1 + 5 files changed, 14 insertions(+) diff --git a/ctdb/config/ctdb.sysconfig b/ctdb/config/ctdb.sysconfig index 3e569961bbb..2ee0b8581c0 100644 --- a/ctdb/config/ctdb.sysconfig +++ b/ctdb/config/ctdb.sysconfig @@ -20,6 +20,11 @@ # default is to not manage Samba # CTDB_MANAGES_SAMBA=yes +# you may wish to raise the file descriptor limit for ctdb +# use a ulimit command here. ctdb needs one file descriptor per +# connected client (ie. one per connected client in Samba) +# ulimit -n 10000 + # the NODES file must be specified or ctdb won't start # it should contain a list of IPs that ctdb will use # it must be exactly the same on all cluster nodes diff --git a/ctdb/config/events.d/50.samba b/ctdb/config/events.d/50.samba index f17f7eac986..0deea3f182a 100755 --- a/ctdb/config/events.d/50.samba +++ b/ctdb/config/events.d/50.samba @@ -17,6 +17,10 @@ case $cmd in smb_dirs=`testparm -st 2> /dev/null | egrep '^\s*path = ' | cut -d= -f2` ctdb_wait_directories "Samba" $smb_dirs + # make sure samba is not already started + service smb stop > /dev/null 2>&1 + service winbind stop > /dev/null 2>&1 + # start Samba service service smb start service winbind start diff --git a/ctdb/config/events.d/59.nfslock b/ctdb/config/events.d/59.nfslock index b030ab5463d..187d35ba41e 100755 --- a/ctdb/config/events.d/59.nfslock +++ b/ctdb/config/events.d/59.nfslock @@ -16,6 +16,8 @@ case $cmd in /bin/mkdir -p /etc/ctdb/state/statd/ip ctdb_wait_directories "nfslock" "$STATD_SHARED_DIRECTORY" + # make sure the service is stopped first + service nfslock stop > /dev/null 2>&1 service nfslock start ;; diff --git a/ctdb/config/events.d/60.nfs b/ctdb/config/events.d/60.nfs index 23fdb088826..258a2309d0c 100755 --- a/ctdb/config/events.d/60.nfs +++ b/ctdb/config/events.d/60.nfs @@ -17,6 +17,8 @@ case $cmd in nfs_dirs=`grep -v '^#' < /etc/exports | cut -d' ' -f1` ctdb_wait_directories "NFS" $nfs_dirs + # make sure nfs is stopped before we start it, or it may get a bind error + service nfs stop > /dev/null 2>&1 service nfs start ;; diff --git a/ctdb/takeover/system.c b/ctdb/takeover/system.c index 60f551b7b56..5d5bd7223f4 100644 --- a/ctdb/takeover/system.c +++ b/ctdb/takeover/system.c @@ -386,6 +386,7 @@ int ctdb_event_script_callback(struct ctdb_context *ctdb, if (state->child == 0) { close(state->fd[0]); ctdb_set_realtime(false); + set_close_on_exec(state->fd[1]); va_start(ap, fmt); ret = ctdb_event_script_v(ctdb, fmt, ap); va_end(ap);