PATCH multi-channel & fd passing

Michael Adam obnox at samba.org
Thu Mar 19 09:54:27 MDT 2015


On 2015-03-19 at 13:27 +0100, Michael Adam wrote:
> On 2015-03-19 at 12:09 +0100, Volker Lendecke wrote:
> > On Thu, Mar 19, 2015 at 10:16:54AM +0000, Noel Power wrote:
> > > it doesn't fix anything but a personal annoyance and something that I
> > > found confusing (e.g. the anonymous block) which was adjacent to code I
> > > was touching to fix some other problem. This was just an alternative to
> > > the orig patch I posted with the fix above, really not worth having a
> > > discussion about, sorry for the noise
> > 
> > Ok. I pushed the other patch, thanks for that fix!
> > 
> > I wonder how we survive the relevant torture tests....
> 
> I have an idea: I think our tests only ever triggered
> the complicated framentation/queing code path, but not
> the fastpath that sends a small message directly, which
> is the code path fixed with Noel's patch.
> 
> Currently working on extending our torture code to
> add a regression test for that (and first of all
> prove or disprove my guess).

Guess proved!

Attached find extensions to the messaging-fdpass tests
that prove it and add regression safety in that respect:

I add two tests

  samba3.smbtorture_s3.LOCAL-MESSAGING-FDPASS2a
  samba3.smbtorture_s3.LOCAL-MESSAGING-FDPASS2b

These are variants of the LOCAL-MESSAGING-FDPASS2
test that sent a very small payload (FDPASS2a)
and no payload at all (FDPASS2b) with the message.

Both trigger the fastpath message sending.
Without Noel's patch both tests hang.
With Noel's patch they pass.

Review/push appreciated.

Thanks - Michael

-------------- next part --------------
From 977cceb857168c74fd6fd914a6cf826c2a241c56 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 19 Mar 2015 12:40:30 +0100
Subject: [PATCH 1/3] s3:torture: prepare the FDPASS2 test to be run with
 variable payload sizes.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/torture/test_messaging_fd_passing.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/source3/torture/test_messaging_fd_passing.c b/source3/torture/test_messaging_fd_passing.c
index 7bee41b..fec7b2d 100644
--- a/source3/torture/test_messaging_fd_passing.c
+++ b/source3/torture/test_messaging_fd_passing.c
@@ -214,7 +214,7 @@ static void child_done_cb(struct tevent_context *ev,
 	state->done = true;
 }
 
-static bool fdpass2_parent(pid_t child_pid, int ready_fd)
+static bool fdpass2_parent(pid_t child_pid, int ready_fd, size_t payload_size)
 {
 	struct tevent_context *ev = NULL;
 	struct messaging_context *msg_ctx = NULL;
@@ -285,8 +285,11 @@ static bool fdpass2_parent(pid_t child_pid, int ready_fd)
 	 * Send a certain payload with the fds, to test to test
 	 * that fd-passing works when we have fragmentation and
 	 * re-assembly of the datagrams.
+	 *
+	 * Fragmentation/queuing is triggered by a certain payload
+	 * size. Payloads below that size use the fast path.
 	 */
-	blob = data_blob_talloc_zero(frame, 1000*1000);
+	blob = data_blob_talloc_zero(frame, payload_size);
 	iov.iov_base = blob.data;
 	iov.iov_len  = blob.length;
 
@@ -343,7 +346,7 @@ done:
 	return retval;
 }
 
-bool run_messaging_fdpass2(int dummy)
+static bool run_messaging_fdpass2_int(int dummy, size_t payload_size)
 {
 	bool retval = false;
 	pid_t child_pid;
@@ -364,8 +367,13 @@ bool run_messaging_fdpass2(int dummy)
 		retval = fdpass2_child(ready_pipe[1]);
 	} else {
 		close(ready_pipe[1]);
-		retval = fdpass2_parent(child_pid, ready_pipe[0]);
+		retval = fdpass2_parent(child_pid, ready_pipe[0], payload_size);
 	}
 
 	return retval;
 }
+
+bool run_messaging_fdpass2(int dummy)
+{
+	return run_messaging_fdpass2_int(dummy, 1000*1000);
+}
-- 
2.1.0


From 9c7f5b13b026b601cdeae31d7a33a3e45b0e6a88 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 19 Mar 2015 12:47:53 +0100
Subject: [PATCH 2/3] s3:torture: add
 samba3.smbtorture_s3.LOCAL-MESSAGING-FDPASS2a test.

This variant of the fdpass2 test tests the non-queuing fast path
by sending a message with only a very small payload.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/selftest/tests.py                   | 1 +
 source3/torture/proto.h                     | 1 +
 source3/torture/test_messaging_fd_passing.c | 9 +++++++++
 source3/torture/torture.c                   | 1 +
 4 files changed, 12 insertions(+)

diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index deed6e6..d83a605 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -111,6 +111,7 @@ local_tests = [
     "LOCAL-MESSAGING-READ4",
     "LOCAL-MESSAGING-FDPASS1",
     "LOCAL-MESSAGING-FDPASS2",
+    "LOCAL-MESSAGING-FDPASS2a",
     "LOCAL-hex_encode_buf",
     "LOCAL-sprintf_append",
     "LOCAL-remove_duplicate_addrs2"]
diff --git a/source3/torture/proto.h b/source3/torture/proto.h
index b12c8be..19e515e 100644
--- a/source3/torture/proto.h
+++ b/source3/torture/proto.h
@@ -119,6 +119,7 @@ bool run_messaging_read3(int dummy);
 bool run_messaging_read4(int dummy);
 bool run_messaging_fdpass1(int dummy);
 bool run_messaging_fdpass2(int dummy);
+bool run_messaging_fdpass2a(int dummy);
 bool run_oplock_cancel(int dummy);
 
 #endif /* __TORTURE_H__ */
diff --git a/source3/torture/test_messaging_fd_passing.c b/source3/torture/test_messaging_fd_passing.c
index fec7b2d..fde5c15 100644
--- a/source3/torture/test_messaging_fd_passing.c
+++ b/source3/torture/test_messaging_fd_passing.c
@@ -377,3 +377,12 @@ bool run_messaging_fdpass2(int dummy)
 {
 	return run_messaging_fdpass2_int(dummy, 1000*1000);
 }
+
+/**
+ * Variant of the FDPASS2 test that tests the non-queuing fast path
+ * with a small payload.
+ */
+bool run_messaging_fdpass2a(int dummy)
+{
+	return run_messaging_fdpass2_int(dummy, 1);
+}
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 4b957af..1a0adba 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -9605,6 +9605,7 @@ static struct {
 	{ "LOCAL-MESSAGING-READ4", run_messaging_read4, 0 },
 	{ "LOCAL-MESSAGING-FDPASS1", run_messaging_fdpass1, 0 },
 	{ "LOCAL-MESSAGING-FDPASS2", run_messaging_fdpass2, 0 },
+	{ "LOCAL-MESSAGING-FDPASS2a", run_messaging_fdpass2a, 0 },
 	{ "LOCAL-BASE64", run_local_base64, 0},
 	{ "LOCAL-RBTREE", run_local_rbtree, 0},
 	{ "LOCAL-MEMCACHE", run_local_memcache, 0},
-- 
2.1.0


From 4f9b7c445d129606c9525416eb076dbc291860ed Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 19 Mar 2015 16:45:09 +0100
Subject: [PATCH 3/3] s3:torture: add
 samba3.smbtorture_s3.LOCAL-MESSAGING-FDPASS2b test.

This variant of the fdpass2 test tests the non-queuing fast path
by sumbitting sending a message without payload, only sending
the fds.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/selftest/tests.py                   | 1 +
 source3/torture/proto.h                     | 1 +
 source3/torture/test_messaging_fd_passing.c | 9 +++++++++
 source3/torture/torture.c                   | 1 +
 4 files changed, 12 insertions(+)

diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index d83a605..a60e711 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -112,6 +112,7 @@ local_tests = [
     "LOCAL-MESSAGING-FDPASS1",
     "LOCAL-MESSAGING-FDPASS2",
     "LOCAL-MESSAGING-FDPASS2a",
+    "LOCAL-MESSAGING-FDPASS2b",
     "LOCAL-hex_encode_buf",
     "LOCAL-sprintf_append",
     "LOCAL-remove_duplicate_addrs2"]
diff --git a/source3/torture/proto.h b/source3/torture/proto.h
index 19e515e..5f1cdcc 100644
--- a/source3/torture/proto.h
+++ b/source3/torture/proto.h
@@ -120,6 +120,7 @@ bool run_messaging_read4(int dummy);
 bool run_messaging_fdpass1(int dummy);
 bool run_messaging_fdpass2(int dummy);
 bool run_messaging_fdpass2a(int dummy);
+bool run_messaging_fdpass2b(int dummy);
 bool run_oplock_cancel(int dummy);
 
 #endif /* __TORTURE_H__ */
diff --git a/source3/torture/test_messaging_fd_passing.c b/source3/torture/test_messaging_fd_passing.c
index fde5c15..465ee28 100644
--- a/source3/torture/test_messaging_fd_passing.c
+++ b/source3/torture/test_messaging_fd_passing.c
@@ -386,3 +386,12 @@ bool run_messaging_fdpass2a(int dummy)
 {
 	return run_messaging_fdpass2_int(dummy, 1);
 }
+
+/**
+ * Variant of the FDPASS2 test that tests the non-queuing fast path
+ * without a payload.
+ */
+bool run_messaging_fdpass2b(int dummy)
+{
+	return run_messaging_fdpass2_int(dummy, 0);
+}
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 1a0adba..f33b6e5 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -9606,6 +9606,7 @@ static struct {
 	{ "LOCAL-MESSAGING-FDPASS1", run_messaging_fdpass1, 0 },
 	{ "LOCAL-MESSAGING-FDPASS2", run_messaging_fdpass2, 0 },
 	{ "LOCAL-MESSAGING-FDPASS2a", run_messaging_fdpass2a, 0 },
+	{ "LOCAL-MESSAGING-FDPASS2b", run_messaging_fdpass2b, 0 },
 	{ "LOCAL-BASE64", run_local_base64, 0},
 	{ "LOCAL-RBTREE", run_local_rbtree, 0},
 	{ "LOCAL-MEMCACHE", run_local_memcache, 0},
-- 
2.1.0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150319/eaf21902/attachment.pgp>


More information about the samba-technical mailing list