From: Stefan Metzmacher Date: Mon, 15 Dec 2025 13:42:10 +0000 (+0100) Subject: s4:torture/smb2: let bench.c tests use the initial connection of just once is needed X-Git-Tag: tdb-1.4.15~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=616ae1af1387429ed242c4edc6d1ee3f6d7cdb10;p=thirdparty%2Fsamba.git s4:torture/smb2: let bench.c tests use the initial connection of just once is needed This makes it easier to analyze wireshark traces, it will be important for smbdirect over roce, as wireshark has some problems there. Signed-off-by: Stefan Metzmacher Reviewed-by: Volker Lendecke --- diff --git a/source4/torture/smb2/bench.c b/source4/torture/smb2/bench.c index 08b9ab513ac..ccf519ca83d 100644 --- a/source4/torture/smb2/bench.c +++ b/source4/torture/smb2/bench.c @@ -403,11 +403,20 @@ static bool test_smb2_bench_echo(struct torture_context *tctx, state->conns[i].state = state; state->conns[i].idx = i; - if (!torture_smb2_connection(tctx, &ct)) { - torture_comment(tctx, "Failed opening %zu/%zu connections\n", i, state->num_conns); - return false; + if (state->num_conns == 1) { + /* + * Use the existing connection + */ + state->conns[i].tree = ct = tree; + } else { + if (!torture_smb2_connection(tctx, &ct)) { + torture_comment(tctx, + "Failed opening %zu/%zu connections\n", + i, state->num_conns); + return false; + } + state->conns[i].tree = talloc_steal(state->conns, ct); } - state->conns[i].tree = talloc_steal(state->conns, ct); smb2cli_conn_set_max_credits(ct->session->transport->conn, 8192); smb2cli_ioctl(ct->session->transport->conn, @@ -885,11 +894,20 @@ bool test_smb2_bench_path_contention_shared(struct torture_context *tctx, state->conns[i].state = state; state->conns[i].idx = i; - if (!torture_smb2_connection(tctx, &ct)) { - torture_comment(tctx, "Failed opening %zd/%zd connections\n", i, state->num_conns); - return false; + if (state->num_conns == 1) { + /* + * Use the existing connection + */ + state->conns[i].tree = ct = tree; + } else { + if (!torture_smb2_connection(tctx, &ct)) { + torture_comment(tctx, + "Failed opening %zu/%zu connections\n", + i, state->num_conns); + return false; + } + state->conns[i].tree = talloc_steal(state->conns, ct); } - state->conns[i].tree = talloc_steal(state->conns, ct); smb2cli_conn_set_max_credits(ct->session->transport->conn, 8192); smb2cli_ioctl(ct->session->transport->conn, @@ -1265,11 +1283,20 @@ static bool test_smb2_bench_read(struct torture_context *tctx, state->conns[i].state = state; state->conns[i].idx = i; - if (!torture_smb2_connection(tctx, &ct)) { - torture_comment(tctx, "Failed opening %zu/%zu connections\n", i, state->num_conns); - return false; + if (state->num_conns == 1) { + /* + * Use the existing connection + */ + state->conns[i].tree = ct = tree; + } else { + if (!torture_smb2_connection(tctx, &ct)) { + torture_comment(tctx, + "Failed opening %zu/%zu connections\n", + i, state->num_conns); + return false; + } + state->conns[i].tree = talloc_steal(state->conns, ct); } - state->conns[i].tree = talloc_steal(state->conns, ct); smb2cli_conn_set_max_credits(ct->session->transport->conn, 8192); smb2cli_ioctl(ct->session->transport->conn, @@ -1784,11 +1811,20 @@ static bool test_smb2_bench_session_setup(struct torture_context *tctx, state->conns[i].state = state; state->conns[i].idx = i; - if (!torture_smb2_connection(tctx, &ct)) { - torture_comment(tctx, "Failed opening %zd/%zd connections\n", i, state->num_conns); - return false; + if (state->num_conns == 1) { + /* + * Use the existing connection + */ + ct = tree; + } else { + if (!torture_smb2_connection(tctx, &ct)) { + torture_comment(tctx, + "Failed opening %zu/%zu connections\n", + i, state->num_conns); + return false; + } + talloc_steal(state->conns, ct); } - talloc_steal(state->conns, ct); state->conns[i].transport = ct->session->transport; smb2cli_conn_set_max_credits(ct->session->transport->conn, 8192);