[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Tue Dec 18 04:32:02 UTC 2018


The branch, master has been updated
       via  1ed91f0e102 ctdb-tests: Do not force TEST_VAR_DIR to be absolute
       via  61b54193fe4 ctdb-event: Force symbolic link targets to be absolute
       via  108aca0a9e7 ctdb-event: Declare and construct data_script only if needed
       via  63a4c634a65 ctdb-tests: Force symbolic link targets to be absolute
       via  45f96c73463 ctdb-event: Force EVENTSCRIPTS_TESTS_VAR_DIR to be absolute
       via  ba83aa9d8b2 ctdb-event: Force script directory to be absolute
       via  da8aaf2aee2 ctdb-recoverd: Call an election when the recovery lock is lost
       via  9d1d5fa4ac3 ctdb-doc: Add non-breaking space to lock_buckets documentation
       via  93284ed0321 ctdb-daemon: Divide by 2 when calculating hop count bucket
      from  b77fae3281a smbd: Don't try to release a kernel oplock for a leased file

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


- Log -----------------------------------------------------------------
commit 1ed91f0e102e3cb67b69e146b8b587e4d0222a8a
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Sep 7 14:48:17 2018 +1000

    ctdb-tests: Do not force TEST_VAR_DIR to be absolute
    
    This can result in Unix domain socket names that are too long.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Tue Dec 18 05:31:00 CET 2018 on sn-devel-144

commit 61b54193fe4e7c122bd06b98a7090a245d54250e
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Sep 7 14:47:24 2018 +1000

    ctdb-event: Force symbolic link targets to be absolute
    
    If CTDB_BASE is relative then symbolic link targets will be incorrect.
    
    Don't force CTDB_BASE to be absolute because this can result in Unix
    domain socket names that are too long.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 108aca0a9e71f2efb699dfeb5e3a1d7e24002de7
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Sep 7 14:35:15 2018 +1000

    ctdb-event: Declare and construct data_script only if needed
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 63a4c634a65afbf04080d3958d1b91d3a8770cc7
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Sep 7 14:45:00 2018 +1000

    ctdb-tests: Force symbolic link targets to be absolute
    
    If CTDB_BASE is relative then the symbolic link target will be
    incorrect.
    
    Don't force CTDB_BASE to be absolute because this can result in Unix
    domain socket names that are too long.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 45f96c73463a1f17e48610e88a6e103f845fb0c1
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Sep 7 16:02:25 2018 +1000

    ctdb-event: Force EVENTSCRIPTS_TESTS_VAR_DIR to be absolute
    
    Event scripts (well, statd_callout) can change directory, causing
    stubs to be unable to locate EVENTSCRIPTS_TESTS_VAR_DIR if it is
    relative.
    
    Don't force TEST_VAR_DIR to be absolute because this can result in
    Unix domain socket names that are too long.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit ba83aa9d8b20b11f1febb77d2607ee2a38456f6e
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Sep 7 13:39:49 2018 +1000

    ctdb-event: Force script directory to be absolute
    
    If TEST_VAR_DIR is relative then symbolic link targets will be
    incorrect.
    
    Don't force TEST_VAR_DIR to be absolute because this can result in
    Unix domain socket names that are too long.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit da8aaf2aee2ff145f3001ae1fcf3626d6a9bc17d
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Nov 8 15:49:30 2018 +1100

    ctdb-recoverd: Call an election when the recovery lock is lost
    
    The lock may have been lost due to a failure in the underlying locking
    mechanism.  This could be due to quorum loss or similar.  It is best
    to call an election to confirm that this node should still be master.
    At worst, the node will reelect itself, fail to take the lock and then
    ban itself.  This is a suitable outcome for a node that has been
    partitioned from others in the cluster.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 9d1d5fa4ac3abfe464dda1c7adc4616927855b57
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Dec 13 12:16:16 2018 +1100

    ctdb-doc: Add non-breaking space to lock_buckets documentation
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 93284ed0321ff96a97d4b56deedbca62c5852c06
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Nov 15 13:58:53 2018 +1100

    ctdb-daemon: Divide by 2 when calculating hop count bucket
    
    This provides finer resolution while still maintaining a reasonable
    maximum.  In this case the top bucket contains any hop counts
    >= 16384, compared to the current situation where the top bucket contains
    hop counts >= 268435456.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

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

Summary of changes:
 ctdb/doc/ctdb-statistics.7.xml            | 26 ++++++++++-------
 ctdb/event/event_tool.c                   | 46 +++++++++++++++++++++++++++----
 ctdb/server/ctdb_call.c                   |  2 +-
 ctdb/server/ctdb_recoverd.c               | 13 ++++-----
 ctdb/tests/cunit/event_script_test_001.sh |  2 ++
 ctdb/tests/eventd/eventd_009.sh           |  5 ++--
 ctdb/tests/eventscripts/scripts/local.sh  |  3 ++
 ctdb/tests/run_tests.sh                   |  4 ---
 8 files changed, 71 insertions(+), 30 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/doc/ctdb-statistics.7.xml b/ctdb/doc/ctdb-statistics.7.xml
index 8d6349d16e6..0cef102e5dd 100644
--- a/ctdb/doc/ctdb-statistics.7.xml
+++ b/ctdb/doc/ctdb-statistics.7.xml
@@ -436,8 +436,10 @@ Statistics collected since  : (000 01:49:20) Fri Sep 12 11:43:12 2014
       <title>hop_count_buckets</title>
       <para>
 	Distribution of migration requests based on hop counts values.
-	Buckets are 1, < 4, < 8, < 16, < 32, < 64, <
-	128, < 256, < 512, ≥ 512.
+	Buckets are 0, < 2, < 4, < 8,
+	< 16, < 32, < 64, < 128,
+	< 256, < 512, < 1024, < 2048,
+	< 4096, < 8192, < 16384, ≥ 16384.
       </para>
     </refsect2>
 
@@ -445,9 +447,10 @@ Statistics collected since  : (000 01:49:20) Fri Sep 12 11:43:12 2014
       <title>lock_buckets</title>
       <para>
 	Distribution of record lock requests based on time required to
-	obtain locks.  Buckets are < 1ms, < 10ms, < 100ms,
-	< 1s, < 2s, < 4s, < 8s, < 16s, < 32s, <
-	64s, ≥ 64s.
+	obtain locks.  Buckets are < 1ms, < 10ms,
+	< 100ms, < 1s, < 2s, < 4s,
+	< 8s, < 16s, < 32s, < 64s,
+	≥ 64s.
       </para>
     </refsect2>
 
@@ -595,8 +598,10 @@ DB Statistics: notify_index.tdb
       <title>hop_count_buckets</title>
       <para>
 	Distribution of migration requests based on hop counts values.
-	Buckets are 1, < 4, < 8, < 16, < 32, < 64, <
-	128, < 256, < 512, ≥ 512.
+	Buckets are 0, < 2, < 4, < 8,
+	< 16, < 32, < 64, < 128,
+	< 256, < 512, < 1024, < 2048,
+	< 4096, < 8192, < 16384, ≥ 16384.
       </para>
     </refsect2>
 
@@ -604,9 +609,10 @@ DB Statistics: notify_index.tdb
       <title>lock_buckets</title>
       <para>
 	Distribution of record lock requests based on time required to
-	obtain locks.  Buckets are < 1ms, < 10ms, < 100ms,
-	< 1s, < 2s, < 4s, < 8s, < 16s, < 32s, <
-	64s, ≥ 64s.
+	obtain locks.  Buckets are < 1ms, < 10ms,
+	< 100ms, < 1s, < 2s, < 4s,
+	< 8s, < 16s, < 32s, < 64s,
+	≥ 64s.
       </para>
     </refsect2>
 
diff --git a/ctdb/event/event_tool.c b/ctdb/event/event_tool.c
index 8350f202cea..6cc5dc9a822 100644
--- a/ctdb/event/event_tool.c
+++ b/ctdb/event/event_tool.c
@@ -308,6 +308,7 @@ static int event_command_script_list(TALLOC_CTX *mem_ctx,
 	char *subdir = NULL;
 	char *data_dir = NULL;
 	char *etc_dir = NULL;
+	char *t = NULL;
 	struct event_script_list *data_list = NULL;
 	struct event_script_list *etc_list = NULL;
 	unsigned int i, j, matched;
@@ -328,6 +329,20 @@ static int event_command_script_list(TALLOC_CTX *mem_ctx,
 		return ENOMEM;
 	}
 
+	t = talloc_size(mem_ctx, PATH_MAX);
+	if (t == NULL) {
+		return ENOMEM;
+	}
+
+	data_dir = realpath(data_dir, t);
+	if (data_dir == NULL) {
+		if (errno != ENOENT) {
+			return errno;
+		}
+		D_ERR("Command script list finished with result=%d\n", ENOENT);
+		return ENOENT;
+	}
+
 	etc_dir = path_etcdir_append(mem_ctx, subdir);
 	if (etc_dir == NULL) {
 		return ENOMEM;
@@ -515,7 +530,7 @@ static int event_command_script_enable(TALLOC_CTX *mem_ctx,
 	struct event_tool_context *ctx = talloc_get_type_abort(
 		private_data, struct event_tool_context);
 	struct stat statbuf;
-	char *script, *etc_script, *data_script;
+	char *script, *etc_script;
 	int ret;
 
 	if (argc != 2) {
@@ -533,11 +548,6 @@ static int event_command_script_enable(TALLOC_CTX *mem_ctx,
 		return ENOMEM;
 	}
 
-	data_script = path_datadir_append(mem_ctx, script);
-	if (data_script == NULL) {
-		return ENOMEM;
-	}
-
 	ret = lstat(etc_script, &statbuf);
 	if (ret == 0) {
 		if (S_ISLNK(statbuf.st_mode)) {
@@ -555,6 +565,30 @@ static int event_command_script_enable(TALLOC_CTX *mem_ctx,
 		return EINVAL;
 	} else {
 		if (errno == ENOENT) {
+			char *t;
+			char *data_script;
+
+			data_script = path_datadir_append(mem_ctx, script);
+			if (data_script == NULL) {
+				return ENOMEM;
+			}
+
+			t = talloc_size(mem_ctx, PATH_MAX);
+			if (t == NULL) {
+				return ENOMEM;
+			}
+
+			data_script = realpath(data_script, t);
+			if (data_script == NULL) {
+				if (errno != ENOENT) {
+					return errno;
+				}
+				printf("Script %s does not exist in %s\n",
+				       argv[1],
+				       argv[0]);
+				return ENOENT;
+			}
+
 			ret = stat(data_script, &statbuf);
 			if (ret != 0) {
 				printf("Script %s does not exist in %s\n",
diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c
index 03059206026..346fe89010e 100644
--- a/ctdb/server/ctdb_call.c
+++ b/ctdb/server/ctdb_call.c
@@ -1092,7 +1092,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 	tmp_count = c->hopcount;
 	bucket = 0;
 	while (tmp_count) {
-		tmp_count >>= 2;
+		tmp_count >>= 1;
 		bucket++;
 	}
 	if (bucket >= MAX_COUNT_BUCKETS) {
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index f000538bae2..578127a4514 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -915,20 +915,19 @@ static void take_reclock_handler(char status,
 	s->locked = (status == '0') ;
 }
 
-static bool ctdb_recovery_lock(struct ctdb_recoverd *rec);
+static void force_election(struct ctdb_recoverd *rec,
+			   uint32_t pnn,
+			   struct ctdb_node_map_old *nodemap);
 
 static void lost_reclock_handler(void *private_data)
 {
 	struct ctdb_recoverd *rec = talloc_get_type_abort(
 		private_data, struct ctdb_recoverd);
 
-	DEBUG(DEBUG_ERR,
-	      ("Recovery lock helper terminated unexpectedly - "
-	       "trying to retake recovery lock\n"));
+	D_ERR("Recovery lock helper terminated, triggering an election\n");
 	TALLOC_FREE(rec->recovery_lock_handle);
-	if (! ctdb_recovery_lock(rec)) {
-		DEBUG(DEBUG_ERR, ("Failed to take recovery lock\n"));
-	}
+
+	force_election(rec, ctdb_get_pnn(rec->ctdb), rec->nodemap);
 }
 
 static bool ctdb_recovery_lock(struct ctdb_recoverd *rec)
diff --git a/ctdb/tests/cunit/event_script_test_001.sh b/ctdb/tests/cunit/event_script_test_001.sh
index 9a264122e9a..0ef93653dc7 100755
--- a/ctdb/tests/cunit/event_script_test_001.sh
+++ b/ctdb/tests/cunit/event_script_test_001.sh
@@ -5,6 +5,8 @@
 scriptdir="${TEST_VAR_DIR}/cunit/scriptdir"
 mkdir -p "${scriptdir}"
 
+scriptdir=$(cd "$scriptdir" && echo "$PWD")
+
 test_cleanup "rm -rf ${scriptdir}"
 
 # Invalid path
diff --git a/ctdb/tests/eventd/eventd_009.sh b/ctdb/tests/eventd/eventd_009.sh
index 1e3d86e28ed..39e5cd658cc 100755
--- a/ctdb/tests/eventd/eventd_009.sh
+++ b/ctdb/tests/eventd/eventd_009.sh
@@ -66,7 +66,8 @@ simple_test script list data
 # Local/3rd-party link, not enabled
 touch "${CTDB_BASE}/foo"
 chmod 644 "${CTDB_BASE}/foo"
-ln -s "${CTDB_BASE}/foo" "${CTDB_BASE}/events/data/04.locallink.script"
+abs_base=$(cd "$CTDB_BASE" && echo "$PWD")
+ln -s "${abs_base}/foo" "${CTDB_BASE}/events/data/04.locallink.script"
 
 ok <<EOF
 * 01.dummy
@@ -99,7 +100,7 @@ simple_test script list data
 
 # Local/3rd-party link, enabled
 chmod +x "${CTDB_BASE}/foo"
-ln -s "${CTDB_BASE}/foo" "${CTDB_BASE}/events/data/04.locallink.script"
+ln -s "${abs_base}/foo" "${CTDB_BASE}/events/data/04.locallink.script"
 
 ok <<EOF
 * 01.dummy
diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh
index ad683cf9934..c0eb72badd1 100644
--- a/ctdb/tests/eventscripts/scripts/local.sh
+++ b/ctdb/tests/eventscripts/scripts/local.sh
@@ -28,6 +28,9 @@ if [ -d "$EVENTSCRIPTS_TESTS_VAR_DIR" ] ; then
 fi
 mkdir -p "$EVENTSCRIPTS_TESTS_VAR_DIR"
 
+# Force this to be absolute - event scripts can change directory
+EVENTSCRIPTS_TESTS_VAR_DIR=$(cd "$EVENTSCRIPTS_TESTS_VAR_DIR" && echo "$PWD")
+
 export CTDB_LOGGING="file:${EVENTSCRIPTS_TESTS_VAR_DIR}/log.ctdb"
 touch "${CTDB_LOGGING#file:}" || \
     die "Unable to setup logging for \"$CTDB_LOGGING\""
diff --git a/ctdb/tests/run_tests.sh b/ctdb/tests/run_tests.sh
index 48fd0624f75..f5be01a8d66 100755
--- a/ctdb/tests/run_tests.sh
+++ b/ctdb/tests/run_tests.sh
@@ -248,10 +248,6 @@ if [ -z "$TEST_VAR_DIR" ] ; then
 fi
 mkdir -p "$TEST_VAR_DIR"
 
-# Must be absolute
-TEST_VAR_DIR=$(cd "$TEST_VAR_DIR"; echo "$PWD")
-echo "TEST_VAR_DIR=$TEST_VAR_DIR"
-
 export TEST_SCRIPTS_DIR="${CTDB_TEST_DIR}/scripts"
 
 unit_tests="


-- 
Samba Shared Repository



More information about the samba-cvs mailing list