[SCM] Samba Shared Repository - branch master updated

Martin Schwenke martins at samba.org
Fri Feb 24 10:51:03 UTC 2017


The branch, master has been updated
       via  52c4d33 ctdb-takeover: Don't release IPs from nodes where they are not known
       via  75d08229 ctdb-ipalloc: Add per-IP known_on bitmap
       via  fd1dc9e ctdb-takeover: Fetch public IP addresses from all connected nodes
       via  cae08c7 ctdb-takeover: Assign banning credits on failure to fetch public IPs
       via  7f5ef12 ctdb-takeover: Use takeover_failed() when fetching public IPs fails
       via  5b1249a ctdb-takeover: Generalise error handling for GET_PUBLIC_IPS
       via  4556bdc ctdb-takeover: Only fetch available IPs from nodes with known IPs
       via  04cddae ctdb-takeover: Add debug message confirming fetching of public IPs
       via  58296e3 ctdb-tests: Populate per-node known IPs inline
       via  5bb6ec6 ctdb-ipalloc: Switch noiphost to struct bitmap
       via  0b4e609 ctdb-ipalloc: Switch available_on to struct bitmap
       via  138deea lib/util: Put bitmap.c into samba-util-core so it is available to CTDB
       via  f7f23dc ctdb-takeover: Short circuit if fetching IPs from no nodes
       via  42bcfa6 ctdb-takeover: Allocate IP list unconditionally in send function
       via  fdc0dbe ctdb-tests: Add synchronisation points in reload IPs tests
       via  2d22454 ctdb-doc: Update instructions in example NFS Ganesha call-out
       via  4fa9026 ctdb-doc: Fix monitoring bug in example NFS Ganesha call-out
       via  1c8a398 ctdb-doc: Fix shellcheck warning in example NFS ganesha call-out
       via  8c21aac ctdb-doc: Make example NFS Ganesha call-out almost pass shellcheck
       via  3f9f31b ctdb-doc: Whitespace fixes in example NFS ganesha callout
       via  42d0577 ctdb-utils: CID 1343331 Unchecked return value from library (CHECKED_RETURN)
       via  55b75e4 ctdb-logging: CID 1396883 Dereference null return value (NULL_RETURNS)
      from  a2daa66 ldb/tools: only use LDB_FLG_SHOW_BINARY for 'ldbsearch'

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


- Log -----------------------------------------------------------------
commit 52c4d33d01646bfd02442150860615173c287336
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 7 15:30:08 2017 +1100

    ctdb-takeover: Don't release IPs from nodes where they are not known
    
    This avoids confusing log messages like:
    
      ctdbd[21635]: releaseip called for an ip '10.1.1.1' that is not a public address
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Fri Feb 24 11:50:36 CET 2017 on sn-devel-144

commit 75d08229858a3f236333aadc6422c18e92e872f8
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 7 15:23:36 2017 +1100

    ctdb-ipalloc: Add per-IP known_on bitmap
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit fd1dc9e0c21e13d08d0d85d3325a00723c535a0c
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 7 15:00:25 2017 +1100

    ctdb-takeover: Fetch public IP addresses from all connected nodes
    
    Redundant releases will be sent to all connected nodes anyway, so this
    is no worse.  This will facilitate an improvement to avoid sending
    releases to nodes with no known IPs.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit cae08c7a3c662389f0109f9246562658efee695a
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Feb 6 12:14:10 2017 +1100

    ctdb-takeover: Assign banning credits on failure to fetch public IPs
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 7f5ef12d625dc05d9f524866e0275a8d1fa73d45
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 3 16:41:42 2017 +1100

    ctdb-takeover: Use takeover_failed() when fetching public IPs fails
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 5b1249a6a884a765538f3e203b5619e11168f190
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 3 16:36:04 2017 +1100

    ctdb-takeover: Generalise error handling for GET_PUBLIC_IPS
    
    As with other controls, processes the errors by hand instead of using
    ctdb_client_control_multi_error().  This will make it easier to add
    banning credits for failures.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 4556bdc7d6b36ddc5a6d3020e784aaa157e5fed5
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 3 15:31:00 2017 +1100

    ctdb-takeover: Only fetch available IPs from nodes with known IPs
    
    A simple optimisation to avoid unnecessary communication.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 04cddae17d3b3a640225209d7a2e2e2ea7367783
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 3 15:26:39 2017 +1100

    ctdb-takeover: Add debug message confirming fetching of public IPs
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 58296e3eae4010270f3bcabd284fe3a2428a21a2
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 3 14:41:57 2017 +1100

    ctdb-tests: Populate per-node known IPs inline
    
    At the moment this is done as a post-processing step for any nodes
    that have no known IPs.  However, this doesn't allow testing of
    scenarios where there no known IPs on one or more nodes.
    
    Add relevant tests.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 5bb6ec6af2359a5b463349df54c168741cb1aca3
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 3 12:28:44 2017 +1100

    ctdb-ipalloc: Switch noiphost to struct bitmap
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 0b4e609194f1f45d80a7e6274f8de66863b8d6de
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Dec 2 14:21:59 2016 +1100

    ctdb-ipalloc: Switch available_on to struct bitmap
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 138deeaa7f6eba59d7b31324060505ade2bd3b5d
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Dec 2 14:21:09 2016 +1100

    lib/util: Put bitmap.c into samba-util-core so it is available to CTDB
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit f7f23dca09418da82d076bd25fb1fa4c328ba76d
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Jan 27 14:43:34 2017 +1100

    ctdb-takeover: Short circuit if fetching IPs from no nodes
    
    The current code will fetch IP from all connected and all active
    nodes, so this can't happen.  However, catch it anyway in case the
    calling code changes.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 42bcfa6a51cd829304742fd3aa70d8958c5b10fe
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Feb 23 16:10:33 2017 +1100

    ctdb-takeover: Allocate IP list unconditionally in send function
    
    This simplifies error handling and make failures less likely after
    send.
    
    This also means that num_nodes is not required in the state.
    
    Also quietly remove unused ev and client from state.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit fdc0dbee29f8cb81dfcb1c995df6468469fd75ce
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 15 19:33:02 2017 +1100

    ctdb-tests: Add synchronisation points in reload IPs tests
    
    "ctdb reloadips" use of ipreallocate() can result in a spurious
    takeover runs.  This can cause a subsequent "ctdb reloadips" to fail
    to disable takeover runs (due to there being one already in progress).
    
    There are various possible improvements but a proper fix probably
    requires a protocol change.  That would mean receiving an ACK for a
    takeover run request to indicate that the request will be processes
    and then a broadcast to indicate a completed takeover run.
    
    There are various other partial fixes (e.g. de-duping queued takeover
    run requests against those in the in-progess queue) and workarounds
    (e.g. always do a double ipreallocate() in the tool, which should
    absorb the spurious takeover run).
    
    However, this is unlikely to be a real-world problem.  Real use cases
    should not involve repeatedly reloading the IP configuration.
    
    Instead, work around the problem of flaky tests by manually adding
    "ctdb sync" commands to cause extra no-op takeover runs.  These should
    not add spurious takeover runs and will create synchronisation points
    to help avoid the issue.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 2d22454f17a691648dc6d26864a896588de944b2
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 22 20:37:14 2017 +1100

    ctdb-doc: Update instructions in example NFS Ganesha call-out
    
    In particular, make them reflect the recent advice in ctdbd.conf(5)
    about setting CTDB_NFS_CHECKS_DIR.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 4fa9026bbd9f67348d3203e0205c59ff4fb51d2d
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 22 18:55:56 2017 +1100

    ctdb-doc: Fix monitoring bug in example NFS Ganesha call-out
    
    There is no "check" method.  This was an error in the original
    example.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 1c8a3988eed5f35462fbd438b5d2e0637117ad4e
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 22 14:44:09 2017 +1100

    ctdb-doc: Fix shellcheck warning in example NFS ganesha call-out
    
    In ctdb/doc/examples/nfs-ganesha-callout line 216:
    for node in `ls ${GANSTATEDIR}`; do
                ^-- SC2045: Iterating over ls output is fragile. Use globs.
                ^-- SC2006: Use $(..) instead of legacy `..`.
                    ^-- SC2086: Double quote to prevent globbing and word splitting.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 8c21aac77fe9e7eaa0cd99099330b3be081c8101
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 22 14:38:45 2017 +1100

    ctdb-doc: Make example NFS Ganesha call-out almost pass shellcheck
    
    This call-out is referred to in the wiki as an example, so make it as
    clean as possible.
    
    All the changes here are trivial.  There is still one failure, which
    is slightly non-trivial, so it can be fixed in a separate commit.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 3f9f31bf25431647a343131edbd52ef15b748895
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 22 14:25:55 2017 +1100

    ctdb-doc: Whitespace fixes in example NFS ganesha callout
    
    Fix some whitespace errors, reindent the whole script and wrap lines
    where needed.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 42d05772174d4eb37ab4d3fdca796dbae5ca044b
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Feb 23 13:14:27 2017 +1100

    ctdb-utils: CID 1343331 Unchecked return value from library (CHECKED_RETURN)
    
    Explicitly ignore keyboard input in ping_pong.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 55b75e4ecec17fdb741c12ad5a22846f77f71215
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Feb 23 11:31:32 2017 +1100

    ctdb-logging: CID 1396883 Dereference null return value (NULL_RETURNS)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12592
    
    The fix in 08e03fa7f5fdc7f988fbbb26929e8c5727f36c2e is incomplete.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

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

Summary of changes:
 ctdb/common/logging.c                         |   1 +
 ctdb/doc/examples/nfs-ganesha-callout         | 342 +++++++++++++-------------
 ctdb/server/ctdb_takeover_helper.c            | 105 +++++---
 ctdb/server/ipalloc.c                         |  37 ++-
 ctdb/server/ipalloc.h                         |   5 +-
 ctdb/server/ipalloc_common.c                  |   4 +-
 ctdb/server/ipalloc_private.h                 |   2 +-
 ctdb/tests/complex/18_ctdb_reloadips.sh       |   6 +
 ctdb/tests/simple/18_ctdb_reloadips.sh        |   2 +
 ctdb/tests/src/ipalloc_read_known_ips.c       |  30 +--
 ctdb/tests/takeover/lcp2.034.sh               |  21 ++
 ctdb/tests/takeover_helper/{012.sh => 030.sh} |  12 +-
 ctdb/tests/takeover_helper/031.sh             |  55 +++++
 ctdb/tests/takeover_helper/140.sh             |   1 +
 ctdb/tests/takeover_helper/240.sh             |   1 +
 ctdb/utils/ping_pong/ping_pong.c              |   2 +-
 lib/util/wscript_build                        |   4 +-
 17 files changed, 394 insertions(+), 236 deletions(-)
 create mode 100755 ctdb/tests/takeover/lcp2.034.sh
 copy ctdb/tests/takeover_helper/{012.sh => 030.sh} (69%)
 create mode 100755 ctdb/tests/takeover_helper/031.sh


Changeset truncated at 500 lines:

diff --git a/ctdb/common/logging.c b/ctdb/common/logging.c
index c8ccf26..8e547c9 100644
--- a/ctdb/common/logging.c
+++ b/ctdb/common/logging.c
@@ -522,6 +522,7 @@ int logging_init(TALLOC_CTX *mem_ctx, const char *logging,
 
 	name = strtok(str, ":");
 	if (name == NULL) {
+		talloc_free(str);
 		return EINVAL;
 	}
 	option = strtok(NULL, ":");
diff --git a/ctdb/doc/examples/nfs-ganesha-callout b/ctdb/doc/examples/nfs-ganesha-callout
index 3e12b36..d1f058b 100755
--- a/ctdb/doc/examples/nfs-ganesha-callout
+++ b/ctdb/doc/examples/nfs-ganesha-callout
@@ -11,18 +11,15 @@
 
 # To use this:
 #
-# * Set CTDB_NFS_CALLOUT in your CTDB configuration to point to this
-#   script
+# * Set CTDB_NFS_CALLOUT in your CTDB configuration to point to (a
+#   copy of) this script, making sure it is executable.
 #
-# * Rename the following files in nfs-checks.d so that they no longer
-#   have the ".check" suffix:
-#     * 10.status.check
-#     * 20.nfs.check
-#     * 30.nlockmgr.check
-#     * 40.mountd.check
-#     * 50.rquotad.check
-#
-# * Install 20.nfs-ganesha.check to nfs-checks.d/20.nfs.check
+# * Create a new directory alongside the nfs-checks.d directory, for
+#   example nfs-checks-ganesha.d.  Install 20.nfs-ganesha.check in
+#   this directory.  Symlink to any other check files from
+#   nfs-checks.d that should still be used, such as
+#   00.portmapper.check.  Set CTDB_NFS_CHECKS_DIR to point to this new
+#   directory of check files.
 #
 # * It is recommended, but not required, to install the grace_period
 #   script (usually shipped in a utils package for NFS-Ganesha) to
@@ -51,20 +48,20 @@ nfs_service="${CTDB_NFS_SERVICE:-nfs-ganesha}"
 ganesha_rec_subdir=${CTDB_GANESHA_REC_SUBDIR:-.ganesha}
 procfs=${PROCFS_PATH:-/proc}
 
-case $state_fs in
-    gpfs)
-        GANRECDIR="/var/lib/nfs/ganesha"
-        ;;
-    glusterfs)
-        if [ -z "${state_dir}" ]; then
-            echo "CTDB_NFS_STATE_MNT not defined for GlusterFS"
-            exit 1
-        fi
-        host=`hostname`
-        NODESTATEDIR="$state_dir/nfs-ganesha/$host"
-        GANSTATEDIR="$state_dir/nfs-ganesha/.noderefs"
-        NODESTATELN="$GANSTATEDIR/$host"
-        ;;
+case "$state_fs" in
+gpfs)
+	GANRECDIR="/var/lib/nfs/ganesha"
+	;;
+glusterfs)
+	if [ -z "${state_dir}" ]; then
+		echo "CTDB_NFS_STATE_MNT not defined for GlusterFS"
+		exit 1
+	fi
+	host=$(hostname)
+	NODESTATEDIR="$state_dir/nfs-ganesha/$host"
+	GANSTATEDIR="$state_dir/nfs-ganesha/.noderefs"
+	NODESTATELN="$GANSTATEDIR/$host"
+	;;
 esac
 
 
@@ -72,8 +69,8 @@ esac
 
 usage ()
 {
-    _c=$(basename $0)
-    cat <<EOF
+	_c=$(basename "$0")
+	cat <<EOF
 usage: $_c { shutdown | startup }
        $_c { stop | start | check } nfs
        $_c { releaseip | takeip }
@@ -88,24 +85,24 @@ EOF
 
 basic_stop ()
 {
-    case "$1" in
+	case "$1" in
 	nfs)
-	    service "$nfs_service" stop
-	    ;;
+		service "$nfs_service" stop
+		;;
 	*)
-	    usage
-    esac
+		usage
+	esac
 }
 
 basic_start ()
 {
-    case "$1" in
+	case "$1" in
 	nfs)
-	    service "$nfs_service" start
-	    ;;
+		service "$nfs_service" start
+		;;
 	*)
-	    usage
-    esac
+		usage
+	esac
 }
 
 ##################################################
@@ -128,17 +125,17 @@ service_stop ()
 
 service_start ()
 {
-    case "$1" in
+	case "$1" in
 	nfs)
-	    basic_start "nfs"
-	    ;;
+		basic_start "nfs"
+		;;
 	nlockmgr)
-	    # Do nothing - used by statd-callout
-	    :
-	    ;;
+		# Do nothing - used by statd-callout
+		:
+		;;
 	*)
-	    usage
-    esac
+		usage
+	esac
 }
 
 ##################################################
@@ -148,129 +145,140 @@ service_start ()
 # Usage: check_ln <TARGET> <LINK>
 check_ln ()
 {
-    if [ ! -L "${2}" ] ; then
-        rm -vrf "${2}"
-    else
-        _t=$(readlink "${2}")
-        if [ "$_t" != "${1}" ] ; then
-            rm -v "${2}"
-        fi
-    fi
-    # This is not an "else".  It also re-creates the link if it was
-    # removed above!
-    if [ ! -e "${2}" ]; then
-        ln -sfv "${1}" "${2}"
-    fi
+	if [ ! -L "${2}" ] ; then
+		rm -vrf "${2}"
+	else
+		_t=$(readlink "${2}")
+		if [ "$_t" != "${1}" ] ; then
+			rm -v "${2}"
+		fi
+	fi
+	# This is not an "else".  It also re-creates the link if it was
+	# removed above!
+	if [ ! -e "${2}" ]; then
+		ln -sfv "${1}" "${2}"
+	fi
 }
 
 # Return 'active' if the shared filesystem is accessible.
 get_cluster_fs_state ()
 {
-    case $state_fs in
-        gpfs)
-            /usr/lpp/mmfs/bin/mmgetstate | awk 'NR == 4 { print $3 }'
-            ;;
-        glusterfs)
-            # Since we're past create_ganesha_recdirs(), we're active.
-            echo "active"
-            ;;
-        *)
-            echo "File system $state_fs not supported"
-            exit 1
-            ;;
-   esac
+	case $state_fs in
+	gpfs)
+		/usr/lpp/mmfs/bin/mmgetstate | awk 'NR == 4 { print $3 }'
+		;;
+	glusterfs)
+		# Since we're past create_ganesha_recdirs(), we're active.
+		echo "active"
+		;;
+	*)
+		echo "File system $state_fs not supported"
+		exit 1
+		;;
+	esac
 }
 
 create_ganesha_recdirs ()
 {
-    if ! _mounts=$(mount | grep $state_fs); then
-      echo "Failed to find mounts of type $state_fs"
-      exit 1
-    fi
-    if [ -z "$_mounts" ]; then
-      echo "startup $state_fs not ready"
-      exit 0
-    fi
-
-    case $state_fs in
-        gpfs)
-            _mntpt=$(echo "$_mounts" | sort | awk 'NR == 1 {print $3}')
-            _link_dst="${_mntpt}/${ganesha_rec_subdir}"
-            mkdir -vp "$_link_dst"
-            check_ln "$_link_dst" "$GANRECDIR"
-            ;;
-        glusterfs)
-            [ -d /var/lib/nfs.backup ] || mv /var/lib/nfs /var/lib/nfs.backup
-            check_ln ${NODESTATEDIR} /var/lib/nfs
-
-            mkdir -p ${NODESTATEDIR}/ganesha/v4recov
-            mkdir -p ${NODESTATEDIR}/ganesha/v4old
-            mkdir -p ${NODESTATEDIR}/statd/sm
-            mkdir -p ${NODESTATEDIR}/statd/sm.bak
-            touch ${NODESTATEDIR}/state
-            touch ${NODESTATEDIR}/statd/state
-
-            mkdir -p ${GANSTATEDIR}
-            check_ln ${NODESTATEDIR} ${NODESTATELN}
-            for node in `ls ${GANSTATEDIR}`; do
-                if [ "${node}" != "${host}" ]; then
-                    check_ln ${GANSTATEDIR}/${node}/ganesha ${NODESTATEDIR}/ganesha/${node}
-                    check_ln ${GANSTATEDIR}/${node}/statd ${NODESTATEDIR}/statd/${node}
-                fi
-            done
-            ;;
-   esac
+	if ! _mounts=$(mount | grep "$state_fs"); then
+		echo "Failed to find mounts of type $state_fs"
+		exit 1
+	fi
+	if [ -z "$_mounts" ]; then
+		echo "startup $state_fs not ready"
+		exit 0
+	fi
+
+	case $state_fs in
+	gpfs)
+		_mntpt=$(echo "$_mounts" | sort | awk 'NR == 1 {print $3}')
+		_link_dst="${_mntpt}/${ganesha_rec_subdir}"
+		mkdir -vp "$_link_dst"
+		check_ln "$_link_dst" "$GANRECDIR"
+		;;
+	glusterfs)
+		[ -d /var/lib/nfs.backup ] || \
+			mv /var/lib/nfs /var/lib/nfs.backup
+		check_ln "$NODESTATEDIR" /var/lib/nfs
+
+		mkdir -p "${NODESTATEDIR}/ganesha/v4recov"
+		mkdir -p "${NODESTATEDIR}/ganesha/v4old"
+		mkdir -p "${NODESTATEDIR}/statd/sm"
+		mkdir -p "${NODESTATEDIR}/statd/sm.bak"
+		touch "${NODESTATEDIR}/state"
+		touch "${NODESTATEDIR}/statd/state"
+
+		mkdir -p "$GANSTATEDIR"
+		check_ln "$NODESTATEDIR" "$NODESTATELN"
+		for _dir in "${GANSTATEDIR}/"* ; do
+			# Handle no directories case
+			if [ ! -d "$_dir" ] ; then
+				break
+			fi
+
+			_node="${_dir##*/}" # basename
+			if [ "${_node}" != "${host}" ]; then
+				check_ln "${GANSTATEDIR}/${_node}/ganesha" \
+					 "${NODESTATEDIR}/ganesha/${_node}"
+				check_ln "${GANSTATEDIR}/${_node}/statd" \
+					 "${NODESTATEDIR}/statd/${_node}"
+			fi
+		done
+		;;
+	esac
 }
 
 service_check ()
 {
-    create_ganesha_recdirs
+	create_ganesha_recdirs
+
+	# Always succeed if cluster filesystem is not active
+	_cluster_fs_state=$(get_cluster_fs_state)
+	if [ "$_cluster_fs_state" != "active" ] ; then
+		return 0
+	fi
+
+	# Check that NFS Ganesha is running, according to PID file
+	_pidfile="/var/run/ganesha.pid"
+	_ganesha="/usr/bin/ganesha.nfsd"
+	if ! { read -r _pid < "$_pidfile" && \
+		grep "$_ganesha" "${procfs}/${_pid}/cmdline" ; } >/dev/null 2>&1
+	then
+
+		echo "ERROR: NFS Ganesha not running according to PID file"
+		return 1
+	fi
 
-    # Always succeed if cluster filesystem is not active
-    _cluster_fs_state=$(get_cluster_fs_state)
-    if [ $_cluster_fs_state != "active" ] ; then
 	return 0
-    fi
-
-    # Check that NFS Ganesha is running, according to PID file
-    _pidfile="/var/run/ganesha.pid"
-    _ganesha="/usr/bin/ganesha.nfsd"
-    if ! { read _pid < "$_pidfile" && \
-	   grep "$_ganesha" "${procfs}/${_pid}/cmdline" ; } >/dev/null 2>&1 ; then
-	echo "ERROR: NFS Ganesha not running according to PID file"
-	return 1
-    fi
-
-    return 0
 }
 
 #-------------------------------------------------
 
 nfs_releaseip ()
 {
-    if [ -x "/usr/bin/grace_period" ]; then
-        /usr/bin/grace_period "2:${2}"
-    else
-        dbus-send --print-reply --system --dest=org.ganesha.nfsd \
-        /org/ganesha/nfsd/admin org.ganesha.nfsd.admin.grace \
-        string:"2:${2}"
-    fi
+	if [ -x "/usr/bin/grace_period" ]; then
+		/usr/bin/grace_period "2:${2}"
+	else
+		dbus-send --print-reply --system --dest=org.ganesha.nfsd \
+			  /org/ganesha/nfsd/admin org.ganesha.nfsd.admin.grace \
+			  string:"2:${2}"
+	fi
 }
 
 nfs_takeip ()
 {
-    case  $state_fs in
-        glusterfs)
-            check_ln ${NODESTATEDIR} ${GANSTATEDIR}/${2}
-            ;;
-    esac
-    if [ -x "/usr/bin/grace_period" ]; then
-        /usr/bin/grace_period "5:${2}"
-    else
-        dbus-send --print-reply --system --dest=org.ganesha.nfsd \
-        /org/ganesha/nfsd/admin org.ganesha.nfsd.admin.grace \
-        string:"5:${2}"
-    fi
+	case  $state_fs in
+	glusterfs)
+		check_ln "$NODESTATEDIR" "${GANSTATEDIR}/${2}"
+		;;
+	esac
+	if [ -x "/usr/bin/grace_period" ]; then
+		/usr/bin/grace_period "5:${2}"
+	else
+		dbus-send --print-reply --system --dest=org.ganesha.nfsd \
+			  /org/ganesha/nfsd/admin org.ganesha.nfsd.admin.grace \
+			  string:"5:${2}"
+	fi
 }
 
 ##################################################
@@ -278,20 +286,20 @@ nfs_takeip ()
 
 nfs_shutdown ()
 {
-    basic_stop "nfs"
+	basic_stop "nfs"
 }
 
 nfs_startup ()
 {
-    basic_stop "nfs" || true
+	basic_stop "nfs" || true
 
-    create_ganesha_recdirs
+	create_ganesha_recdirs
 
-    basic_start "nfs"
-    _f="${procfs}/sys/net/ipv4/tcp_tw_recycle"
-    if [ "$_f" ] ; then
-	echo 1 >"$_f"
-    fi
+	basic_start "nfs"
+	_f="${procfs}/sys/net/ipv4/tcp_tw_recycle"
+	if [ "$_f" ] ; then
+		echo 1 >"$_f"
+	fi
 }
 
 ##################################################
@@ -299,21 +307,21 @@ nfs_startup ()
 
 nfs_monitor_list_shares ()
 {
-    grep Path $nfs_exports_file |
-	cut -f2 -d\" |
-	sort -u
+	grep Path "$nfs_exports_file" |
+		cut -f2 -d\" |
+		sort -u
 }
 
 ##################################################
 
 nfs_register ()
 {
-    cat <<EOF
+	cat <<EOF
 shutdown
 startup
 stop
 start
-check
+monitor-pre
 releaseip
 takeip
 monitor-list-shares
@@ -326,19 +334,19 @@ action="$1"
 shift
 
 case "$action" in
-    shutdown)            nfs_shutdown            ;;
-    startup)             nfs_startup             ;;
-    stop)                service_stop "$1"       ;;
-    start)               service_start "$1"      ;;
-    check)               service_check "$1"      ;;
-    releaseip)           nfs_releaseip "$@"      ;;
-    takeip)              nfs_takeip "$@"         ;;
-    monitor-list-shares) nfs_monitor_list_shares ;;
-    register)            nfs_register            ;;
-    monitor-pre|monitor-post|releaseip-pre|takeip-pre)
+shutdown)            nfs_shutdown            ;;
+startup)             nfs_startup             ;;
+stop)                service_stop "$1"       ;;
+start)               service_start "$1"      ;;
+monitor-pre)         service_check "$1"      ;;
+releaseip)           nfs_releaseip "$@"      ;;
+takeip)              nfs_takeip "$@"         ;;
+monitor-list-shares) nfs_monitor_list_shares ;;
+register)            nfs_register            ;;
+monitor-post|releaseip-pre|takeip-pre)
 	# Not required/implemented
 	:
 	;;
-    *)
+*)
 	usage
 esac
diff --git a/ctdb/server/ctdb_takeover_helper.c b/ctdb/server/ctdb_takeover_helper.c
index 5f537c4..5efd619 100644
--- a/ctdb/server/ctdb_takeover_helper.c
+++ b/ctdb/server/ctdb_takeover_helper.c
@@ -88,11 +88,10 @@ determine_algorithm(const struct ctdb_tunable_list *tunables)
 /**********************************************************************/
 
 struct get_public_ips_state {
-	struct tevent_context *ev;
-	struct ctdb_client_context *client;
 	uint32_t *pnns;
-	int count, num_nodes;
+	int count;
 	struct ctdb_public_ip_list *ips;
+	uint32_t *ban_credits;
 };
 
 static void get_public_ips_done(struct tevent_req *subreq);
@@ -103,6 +102,7 @@ static struct tevent_req *get_public_ips_send(
 				struct ctdb_client_context *client,
 				uint32_t *pnns,
 				int count, int num_nodes,
+				uint32_t *ban_credits,
 				bool available_only)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list