[SCM] Samba Shared Repository - branch v4-5-stable updated

Karolin Seeger kseeger at samba.org
Mon Jan 30 10:18:52 UTC 2017


The branch, v4-5-stable has been updated
       via  49c473f VERSION: Disable git snapshots for the 4.5.5 release.
       via  0c540f8 WHATSNEW: Add release notes for Samba 4.5.5.
       via  4387d85 Revert "vfs_fruit: fix fruit:resource option spelling, but not behaviour"
       via  415864f script/release.sh: fix off by 1 error in announce.${tagname}.mail.txt creation
       via  b8ae9cd vfs_default: unlock the right file in copy chunk
       via  4426d43 ctdb-tests: Add "13.per_ip_routing shutdown" test
       via  88ef026 ctdb-scripts: Fix regression when cleaning up routing table IDs
       via  5650e20 ctdb-scripts: Fix remaining uses of "ctdb gratiousarp"
       via  3d55b17 ctdb-tests: Add robust mutex test
       via  8fe2fc0 ctdb-locking: Explicitly unlock record/db in lock helper
       via  727f5d4 ctdb-locking: Remove support for locking multiple databases
       via  430cad1 VERSION: Bump version up to 4.5.5...
      from  f00d8b0 VERSION: Disable git snapshots for the 4.5.4 release.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-5-stable


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                          |    2 +-
 WHATSNEW.txt                                     |   55 +-
 ctdb/config/events.d/10.interface                |    4 +-
 ctdb/config/events.d/13.per_ip_routing           |    8 +-
 ctdb/config/events.d/91.lvs                      |    2 +-
 ctdb/doc/ctdb.1.xml                              |    4 +-
 ctdb/server/ctdb_lock.c                          |    6 +-
 ctdb/server/ctdb_lock_helper.c                   |  201 +-
 ctdb/tests/eventscripts/13.per_ip_routing.024.sh |   31 +
 ctdb/tests/eventscripts/stubs/ctdb               |    2 +-
 ctdb/tests/src/test_mutex_raw.c                  |  261 ++
 ctdb/wscript                                     |    8 +-
 docs-xml/manpages/vfs_fruit.8.xml                |    8 +-
 lib/torture/torture.h                            |   10 -
 script/release.sh                                |    5 +-
 selftest/target/Samba3.pm                        |   26 +-
 selftest/target/Samba4.pm                        |    2 +-
 source3/include/MacExtensions.h                  |    3 -
 source3/modules/vfs_catia.c                      | 1052 -------
 source3/modules/vfs_default.c                    |    2 +-
 source3/modules/vfs_fruit.c                      | 3351 ++++++----------------
 source3/modules/vfs_streams_xattr.c              |    6 +-
 source3/selftest/tests.py                        |    7 +-
 source4/torture/vfs/fruit.c                      |  398 +--
 source4/torture/vfs/vfs.c                        |   37 +-
 25 files changed, 1516 insertions(+), 3975 deletions(-)
 create mode 100755 ctdb/tests/eventscripts/13.per_ip_routing.024.sh
 create mode 100644 ctdb/tests/src/test_mutex_raw.c


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 5a6461b..fd6a745 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=5
-SAMBA_VERSION_RELEASE=4
+SAMBA_VERSION_RELEASE=5
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index e0269f6..4c96fef 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,4 +1,55 @@
                    =============================
+                   Release Notes for Samba 4.5.5
+                          January 30, 2017
+                   =============================
+
+
+This is the latest stable release of the Samba 4.5 release series.
+
+Samba 4.5.4 erroneously included a rewrite of the vfs_fruit module.
+This patchset will be reverted with this release, because it needs to pass the
+review process first. If you are using the vfs_fruit module, please do not use
+Samba 4.5.4.
+
+Changes since 4.5.4:
+--------------------
+
+o  Amitay Isaacs <amitay at gmail.com>
+   * BUG 12469: ctdb-locking: Explicitly unlock record/db in lock helper.
+
+o  Björn Jacke <bj at sernet.de>
+   * BUG 12535: vfs_default: Unlock the right file in copy chunk.
+
+o  Martin Schwenke <martin at meltin.net>
+   * BUG 12512: ctdb-scripts: Fix remaining uses of "ctdb gratiousarp".
+   * BUG 12516: /etc/iproute2/rt_tables gets populated with multiple
+     'default' entries.
+
+
+#######################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the Samba 4.1 and newer product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
+                   =============================
                    Release Notes for Samba 4.5.4
                           January 18, 2017
                    =============================
@@ -68,8 +119,8 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
+
 
                    =============================
                    Release Notes for Samba 4.5.3
diff --git a/ctdb/config/events.d/10.interface b/ctdb/config/events.d/10.interface
index 51abc44..e41596d 100755
--- a/ctdb/config/events.d/10.interface
+++ b/ctdb/config/events.d/10.interface
@@ -215,7 +215,7 @@ updateip)
 	# 2) remove the IP from the old interface (and new interface, to be sure)
 	# 3) add the IP to the new interface
 	# 4) remove the firewall rule
-	# 5) use ctdb gratiousarp to propagate the new mac address
+	# 5) use ctdb gratarp to propagate the new mac address
 	# 6) use netstat -tn to find existing connections, and tickle them
 	_oiface=$2
 	niface=$3
@@ -240,7 +240,7 @@ updateip)
 	flush_route_cache
 
 	# propagate the new mac address
-	$CTDB gratiousarp "$ip" "$niface"
+	$CTDB gratarp "$ip" "$niface"
 
 	# tickle all existing connections, so that dropped packets
 	# are retransmited and the tcp streams work
diff --git a/ctdb/config/events.d/13.per_ip_routing b/ctdb/config/events.d/13.per_ip_routing
index f0e4609..41724bb 100755
--- a/ctdb/config/events.d/13.per_ip_routing
+++ b/ctdb/config/events.d/13.per_ip_routing
@@ -184,8 +184,8 @@ clean_up_table_ids ()
 	    -v pre="$table_id_prefix" \
 	    '/^#/ ||
 	     !(min <= $1 && $1 <= max) &&
-	     !(index($2, pre) == 1)
-	     { print $0 }' "$rt_tables" >"$_tmp"
+	     !(index($2, pre) == 1) {
+		print $0 }' "$rt_tables" >"$_tmp"
 
 	mv "$_tmp" "$rt_tables"
     ) 9>"$rt_tables_lock"
@@ -398,7 +398,7 @@ takeip)
 	# flush our route cache
 	set_proc sys/net/ipv4/route/flush 1
 
-	$CTDB gratiousarp "$ip" "$iface"
+	$CTDB gratarp "$ip" "$iface"
 	;;
 
 updateip)
@@ -416,7 +416,7 @@ updateip)
 	# flush our route cache
 	set_proc sys/net/ipv4/route/flush 1
 
-	$CTDB gratiousarp "$ip" "$niface"
+	$CTDB gratarp "$ip" "$niface"
 	tickle_tcp_connections "$ip"
 	;;
 
diff --git a/ctdb/config/events.d/91.lvs b/ctdb/config/events.d/91.lvs
index 052b509..9725ee8 100755
--- a/ctdb/config/events.d/91.lvs
+++ b/ctdb/config/events.d/91.lvs
@@ -110,7 +110,7 @@ ipreallocated)
 	ipvsadm -a -t "$CTDB_LVS_PUBLIC_IP" -r 127.0.0.1
 	ipvsadm -a -u "$CTDB_LVS_PUBLIC_IP" -r 127.0.0.1
 
-	$CTDB gratiousarp \
+	$CTDB gratarp \
 	     "$CTDB_LVS_PUBLIC_IP" "$CTDB_LVS_PUBLIC_IFACE" >/dev/null 2>&1
 
 	flush_route_cache
diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml
index d295213..71af0a5 100644
--- a/ctdb/doc/ctdb.1.xml
+++ b/ctdb/doc/ctdb.1.xml
@@ -1353,9 +1353,9 @@ dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets
     </refsect2>
 
     <refsect2>
-      <title>gratiousarp <parameter>IPADDR</parameter> <parameter>INTERFACE</parameter></title>
+      <title>gratarp <parameter>IPADDR</parameter> <parameter>INTERFACE</parameter></title>
       <para>
-	Send out a gratious ARP for the specified interface through
+	Send out a gratuitous ARP for the specified interface through
 	the specified interface. This command is mainly used by the
 	ctdb eventscripts.
       </para>
diff --git a/ctdb/server/ctdb_lock.c b/ctdb/server/ctdb_lock.c
index 405a29e..5ecf454e 100644
--- a/ctdb/server/ctdb_lock.c
+++ b/ctdb/server/ctdb_lock.c
@@ -192,7 +192,7 @@ static int ctdb_lock_context_destructor(struct lock_context *lock_ctx)
 		lock_ctx->request->lctx = NULL;
 	}
 	if (lock_ctx->child > 0) {
-		ctdb_kill(lock_ctx->ctdb, lock_ctx->child, SIGKILL);
+		ctdb_kill(lock_ctx->ctdb, lock_ctx->child, SIGTERM);
 		if (lock_ctx->type == LOCK_RECORD) {
 			DLIST_REMOVE(lock_ctx->ctdb_db->lock_current, lock_ctx);
 		} else {
@@ -672,7 +672,7 @@ static void ctdb_lock_schedule(struct ctdb_context *ctdb)
 					    ctdb_lock_timeout_handler,
 					    (void *)lock_ctx);
 	if (lock_ctx->ttimer == NULL) {
-		ctdb_kill(ctdb, lock_ctx->child, SIGKILL);
+		ctdb_kill(ctdb, lock_ctx->child, SIGTERM);
 		lock_ctx->child = -1;
 		close(lock_ctx->fd[0]);
 		return;
@@ -687,7 +687,7 @@ static void ctdb_lock_schedule(struct ctdb_context *ctdb)
 				      (void *)lock_ctx);
 	if (lock_ctx->tfd == NULL) {
 		TALLOC_FREE(lock_ctx->ttimer);
-		ctdb_kill(ctdb, lock_ctx->child, SIGKILL);
+		ctdb_kill(ctdb, lock_ctx->child, SIGTERM);
 		lock_ctx->child = -1;
 		close(lock_ctx->fd[0]);
 		return;
diff --git a/ctdb/server/ctdb_lock_helper.c b/ctdb/server/ctdb_lock_helper.c
index 8aa0870..c4f628f 100644
--- a/ctdb/server/ctdb_lock_helper.c
+++ b/ctdb/server/ctdb_lock_helper.c
@@ -20,8 +20,12 @@
 #include "replace.h"
 #include "system/filesys.h"
 #include "system/network.h"
+#include "system/wait.h"
 
 #include <talloc.h>
+#include <tevent.h>
+
+#include "lib/util/tevent_unix.h"
 
 #include "ctdb_private.h"
 
@@ -30,6 +34,11 @@
 static char *progname = NULL;
 static bool realtime = true;
 
+struct lock_state {
+	struct tdb_context *tdb;
+	TDB_DATA key;
+};
+
 static void set_priority(void)
 {
 	const char *ptr;
@@ -72,7 +81,7 @@ static void usage(void)
 	fprintf(stderr, "\n");
 	fprintf(stderr, "Usage: %s <log-fd> <ctdbd-pid> <output-fd> RECORD <db-path> <db-flags> <db-key>\n",
 		progname);
-	fprintf(stderr, "       %s <log-fd> <ctdbd-pid> <output-fd> DB <db1-path> <db1-flags> [<db2-path> <db2-flags>...]\n",
+	fprintf(stderr, "       %s <log-fd> <ctdbd-pid> <output-fd> DB <db1-path> <db1-flags>\n",
 		progname);
 }
 
@@ -93,10 +102,9 @@ static uint8_t *hex_decode_talloc(TALLOC_CTX *mem_ctx,
 	return buffer;
 }
 
-static int lock_record(const char *dbpath, const char *dbflags, const char *dbkey)
+static int lock_record(const char *dbpath, const char *dbflags,
+		       const char *dbkey, struct lock_state *state)
 {
-	TDB_DATA key;
-	struct tdb_context *tdb;
 	int tdb_flags;
 
 	/* No error checking since CTDB always passes sane values */
@@ -104,23 +112,25 @@ static int lock_record(const char *dbpath, const char *dbflags, const char *dbke
 
 	/* Convert hex key to key */
 	if (strcmp(dbkey, "NULL") == 0) {
-		key.dptr = NULL;
-		key.dsize = 0;
+		state->key.dptr = NULL;
+		state->key.dsize = 0;
 	} else {
-		key.dptr = hex_decode_talloc(NULL, dbkey, &key.dsize);
+		state->key.dptr = hex_decode_talloc(NULL, dbkey,
+						    &state->key.dsize);
 	}
 
-	tdb = tdb_open(dbpath, 0, tdb_flags, O_RDWR, 0600);
-	if (tdb == NULL) {
-		fprintf(stderr, "%s: Error opening database %s\n", progname, dbpath);
+	state->tdb = tdb_open(dbpath, 0, tdb_flags, O_RDWR, 0600);
+	if (state->tdb == NULL) {
+		fprintf(stderr, "%s: Error opening database %s\n",
+			progname, dbpath);
 		return 1;
 	}
 
 	set_priority();
 
-	if (tdb_chainlock(tdb, key) < 0) {
+	if (tdb_chainlock(state->tdb, state->key) < 0) {
 		fprintf(stderr, "%s: Error getting record lock (%s)\n",
-			progname, tdb_errorstr(tdb));
+			progname, tdb_errorstr(state->tdb));
 		return 1;
 	}
 
@@ -130,26 +140,26 @@ static int lock_record(const char *dbpath, const char *dbflags, const char *dbke
 
 }
 
-
-static int lock_db(const char *dbpath, const char *dbflags)
+static int lock_db(const char *dbpath, const char *dbflags,
+		   struct lock_state *state)
 {
-	struct tdb_context *tdb;
 	int tdb_flags;
 
 	/* No error checking since CTDB always passes sane values */
 	tdb_flags = strtol(dbflags, NULL, 0);
 
-	tdb = tdb_open(dbpath, 0, tdb_flags, O_RDWR, 0600);
-	if (tdb == NULL) {
-		fprintf(stderr, "%s: Error opening database %s\n", progname, dbpath);
+	state->tdb = tdb_open(dbpath, 0, tdb_flags, O_RDWR, 0600);
+	if (state->tdb == NULL) {
+		fprintf(stderr, "%s: Error opening database %s\n",
+			progname, dbpath);
 		return 1;
 	}
 
 	set_priority();
 
-	if (tdb_lockall(tdb) < 0) {
+	if (tdb_lockall(state->tdb) < 0) {
 		fprintf(stderr, "%s: Error getting db lock (%s)\n",
-			progname, tdb_errorstr(tdb));
+			progname, tdb_errorstr(state->tdb));
 		return 1;
 	}
 
@@ -158,13 +168,114 @@ static int lock_db(const char *dbpath, const char *dbflags)
 	return 0;
 }
 
+struct wait_for_parent_state {
+	struct tevent_context *ev;
+	pid_t ppid;
+};
+
+static void wait_for_parent_check(struct tevent_req *subreq);
+
+static struct tevent_req *wait_for_parent_send(TALLOC_CTX *mem_ctx,
+					       struct tevent_context *ev,
+					       pid_t ppid)
+{
+	struct tevent_req *req, *subreq;
+	struct wait_for_parent_state *state;
+
+	req = tevent_req_create(mem_ctx, &state, struct wait_for_parent_state);
+	if (req == NULL) {
+		return NULL;
+	}
+
+	state->ev = ev;
+	state->ppid = ppid;
+
+	if (ppid == 1) {
+		tevent_req_done(req);
+		return tevent_req_post(req, ev);
+	}
+
+	subreq = tevent_wakeup_send(state, ev,
+				    tevent_timeval_current_ofs(5,0));
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq, wait_for_parent_check, req);
+
+	return req;
+}
+
+static void wait_for_parent_check(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct wait_for_parent_state *state = tevent_req_data(
+		req, struct wait_for_parent_state);
+	bool status;
+
+	status = tevent_wakeup_recv(subreq);
+	TALLOC_FREE(subreq);
+	if (! status) {
+		/* Ignore error */
+		fprintf(stderr, "locking: tevent_wakeup_recv() failed\n");
+	}
+
+	if (kill(state->ppid, 0) == -1 && errno == ESRCH) {
+		tevent_req_done(req);
+		return;
+	}
+
+	subreq = tevent_wakeup_send(state, state->ev,
+				    tevent_timeval_current_ofs(5,0));
+	if (tevent_req_nomem(subreq, req)) {
+		return;
+	}
+	tevent_req_set_callback(subreq, wait_for_parent_check, req);
+}
+
+static bool wait_for_parent_recv(struct tevent_req *req)
+{
+	if (tevent_req_is_unix_error(req, NULL)) {
+		return false;
+	}
+
+	return true;
+}
+
+static void cleanup(struct lock_state *state)
+{
+	if (state->tdb != NULL) {
+		if (state->key.dsize == 0) {
+			tdb_unlockall(state->tdb);
+		} else {
+			tdb_chainunlock(state->tdb, state->key);
+		}
+		tdb_close(state->tdb);
+	}
+}
+
+static void signal_handler(struct tevent_context *ev,
+			   struct tevent_signal *se,
+			   int signum, int count, void *siginfo,
+			   void *private_data)
+{
+	struct lock_state *state = (struct lock_state *)private_data;
+
+	cleanup(state);
+	exit(0);
+}
 
 int main(int argc, char *argv[])
 {
+	struct tevent_context *ev;
+	struct tevent_signal *se;
+	struct tevent_req *req;
+	struct lock_state state = { 0 };
 	int write_fd, log_fd;
 	char result = 0;
 	int ppid;
 	const char *lock_type;
+	bool status;
 
 	reset_scheduler();
 
@@ -186,6 +297,20 @@ int main(int argc, char *argv[])
 	write_fd = atoi(argv[3]);
 	lock_type = argv[4];
 
+	ev = tevent_context_init(NULL);
+	if (ev == NULL) {
+		fprintf(stderr, "locking: tevent_context_init() failed\n");
+		exit(1);
+	}
+
+	se = tevent_add_signal(ev, ev, SIGTERM, 0,
+			       signal_handler, &state);
+	if (se == NULL) {
+		fprintf(stderr, "locking: tevent_add_signal() failed\n");
+		talloc_free(ev);
+		exit(1);
+	}
+
 	if (strcmp(lock_type, "RECORD") == 0) {
 		if (argc != 8) {
 			fprintf(stderr, "%s: Invalid number of arguments (%d)\n",
@@ -193,20 +318,17 @@ int main(int argc, char *argv[])
 			usage();
 			exit(1);
 		}
-		result = lock_record(argv[5], argv[6], argv[7]);
+		result = lock_record(argv[5], argv[6], argv[7], &state);
 
 	} else if (strcmp(lock_type, "DB") == 0) {
-		int n;
-
-		/* If there are no databases specified, no need for lock */
-		if (argc > 5) {
-			for (n=5; n+1<argc; n+=2) {
-				result = lock_db(argv[n], argv[n+1]);
-				if (result != 0) {
-					break;
-				}
-			}
+		if (argc != 7) {
+			fprintf(stderr,
+				"locking: Invalid number of arguments (%d)\n",
+				argc);
+			usage();
+			exit(1);
 		}
+		result = lock_db(argv[5], argv[6], &state);
 
 	} else {
 		fprintf(stderr, "%s: Invalid lock-type '%s'\n", progname, lock_type);
@@ -216,6 +338,21 @@ int main(int argc, char *argv[])
 
 	send_result(write_fd, result);
 
-	ctdb_wait_for_process_to_exit(ppid);
+	req = wait_for_parent_send(ev, ev, ppid);
+	if (req == NULL) {
+		fprintf(stderr, "locking: wait_for_parent_send() failed\n");
+		cleanup(&state);
+		exit(1);
+	}
+
+	tevent_req_poll(req, ev);
+
+	status = wait_for_parent_recv(req);
+	if (! status) {


-- 
Samba Shared Repository



More information about the samba-cvs mailing list