[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Sat May 24 08:17:04 MDT 2014


The branch, master has been updated
       via  a448699 torture3: Add a little gencache_parse load test
       via  8f3be3d Exit with ctdb_fatal if serverids_exist fails
       via  aaaff84 dbwrap_ctdb: open locally with TDB_VOLATILE if requested
       via  b8ae6f8 s3:smbd: let default_sys_recvfile() and sys_recvfile() cope with non-blocking sockets.
      from  ec4496b unix_msg: Simplify unix_msg_send a bit

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


- Log -----------------------------------------------------------------
commit a448699b7dcb310e4d47d9d9e7ef0291b6c3760f
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Mar 10 15:43:19 2014 +0100

    torture3: Add a little gencache_parse load test
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Sat May 24 16:16:43 CEST 2014 on sn-devel-104

commit 8f3be3dcff8c42a93be3c0841b34250c795fb1c4
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jul 4 14:22:28 2013 +0200

    Exit with ctdb_fatal if serverids_exist fails
    
    The only reason why this could fail is a severe ctdb communications
    problem. The normal way to deal with this is ctdb_fatal. This avoids a
    confusing panic in get_share_mode_lock when ctdb is shutdown while this
    call happens.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit aaaff84b44dc211cf678b98320c55ca0e6eb3a46
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Mar 17 12:21:28 2014 +0100

    dbwrap_ctdb: open locally with TDB_VOLATILE if requested
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit b8ae6f8f57271fd4b8c57d5b800930b8558c1b4a
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Apr 15 12:43:06 2014 -0700

    s3:smbd: let default_sys_recvfile() and sys_recvfile() cope with non-blocking sockets.
    
    default_sys_recvfile() and splice() recvfile were not
    written to cope with non-blocking sockets.
    
    When either the socket read() or splice() return
    -1 with errno EWOULDBLOCK or EAGAIN, if no bytes have been
    processed yet, return -1 and let the caller set
    blocking and retry. If bytes have been processed,
    just return them as a short read and let the
    caller retry with the remaining needed reads.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

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

Summary of changes:
 source3/lib/ctdbd_conn.c         |    8 +++---
 source3/lib/dbwrap/dbwrap_ctdb.c |    2 +-
 source3/lib/recvfile.c           |   46 ++++++++++++++++++++++++++++++++++++-
 source3/torture/torture.c        |   24 +++++++++++++++++++
 4 files changed, 73 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index fae3f90..35845ed 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -1166,7 +1166,6 @@ bool ctdb_serverids_exist(struct ctdbd_connection *conn,
 	NTSTATUS status;
 	struct ctdb_vnn_list *vnns = NULL;
 	unsigned num_vnns;
-	bool result = false;
 
 	if (!ctdb_collect_vnns(talloc_tos(), pids, num_pids,
 			       &vnns, &num_vnns)) {
@@ -1303,10 +1302,11 @@ bool ctdb_serverids_exist(struct ctdbd_connection *conn,
 		num_received += 1;
 	}
 
-	result = true;
-fail:
 	TALLOC_FREE(vnns);
-	return result;
+	return true;
+fail:
+	cluster_fatal("serverids_exist failed");
+	return false;
 #endif /* HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL */
 }
 
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index 7cf90ce..ca33c8f 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -1616,7 +1616,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
 	result->lock_order = lock_order;
 
 	/* only pass through specific flags */
-	tdb_flags &= TDB_SEQNUM;
+	tdb_flags &= TDB_SEQNUM|TDB_VOLATILE;
 
 	/* honor permissions if user has specified O_CREAT */
 	if (open_flags & O_CREAT) {
diff --git a/source3/lib/recvfile.c b/source3/lib/recvfile.c
index 500a7e4..bffe07f 100644
--- a/source3/lib/recvfile.c
+++ b/source3/lib/recvfile.c
@@ -75,8 +75,33 @@ static ssize_t default_sys_recvfile(int fromfd,
 		ssize_t read_ret;
 		size_t toread = MIN(bufsize,count - total);
 
-		/* Read from socket - ignore EINTR. */
-		read_ret = sys_read(fromfd, buffer, toread);
+		/*
+		 * Read from socket - ignore EINTR.
+		 * Can't use sys_read() as that also
+		 * ignores EAGAIN and EWOULDBLOCK.
+		 */
+		do {
+			read_ret = read(fromfd, buffer, toread);
+		} while (read_ret == -1 && errno == EINTR);
+
+#if defined(EWOULDBLOCK)
+		if (read_ret == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
+#else
+		if (read_ret == -1 && (errno == EAGAIN)) {
+#endif
+			/*
+			 * fromfd socket is in non-blocking mode.
+			 * If we already read some and wrote
+			 * it successfully, return that.
+			 * Only return -1 if this is the first read
+			 * attempt. Caller will handle both cases.
+			 */
+			if (total_written != 0) {
+				return total_written;
+			}
+			return -1;
+		}
+
 		if (read_ret <= 0) {
 			/* EOF or socket error. */
 			return -1;
@@ -184,6 +209,23 @@ ssize_t sys_recvfile(int fromfd,
 				return default_sys_recvfile(fromfd, tofd,
 							    offset, count);
 			}
+#if defined(EWOULDBLOCK)
+			if (errno == EAGAIN || errno == EWOULDBLOCK) {
+#else
+			if (errno == EAGAIN) {
+#endif
+				/*
+				 * fromfd socket is in non-blocking mode.
+				 * If we already read some and wrote
+				 * it successfully, return that.
+				 * Only return -1 if this is the first read
+				 * attempt. Caller will handle both cases.
+				 */
+				if (total_written != 0) {
+					return total_written;
+				}
+				return -1;
+			}
 			break;
 		}
 
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 95d8b33..cea9089 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -8119,12 +8119,26 @@ static bool run_local_base64(int dummy)
 	return ret;
 }
 
+static void parse_fn(time_t timeout, DATA_BLOB blob, void *private_data)
+{
+	return;
+}
+
 static bool run_local_gencache(int dummy)
 {
 	char *val;
 	time_t tm;
 	DATA_BLOB blob;
 	char v;
+	struct memcache *mem;
+	int i;
+
+	mem = memcache_init(NULL, 0);
+	if (mem == NULL) {
+		d_printf("%s: memcache_init failed\n", __location__);
+		return false;
+	}
+	memcache_set_global(mem);
 
 	if (!gencache_set("foo", "bar", time(NULL) + 1000)) {
 		d_printf("%s: gencache_set() failed\n", __location__);
@@ -8136,6 +8150,16 @@ static bool run_local_gencache(int dummy)
 		return False;
 	}
 
+	for (i=0; i<1000000; i++) {
+		gencache_parse("foo", parse_fn, NULL);
+	}
+
+	if (!gencache_get("foo", talloc_tos(), &val, &tm)) {
+		d_printf("%s: gencache_get() failed\n", __location__);
+		return False;
+	}
+	TALLOC_FREE(val);
+
 	if (!gencache_get("foo", talloc_tos(), &val, &tm)) {
 		d_printf("%s: gencache_get() failed\n", __location__);
 		return False;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list