From 9944a67508ee437f6fd38bb2ce77ce1f5cbfac50 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 9 Dec 2006 03:16:17 +0000 Subject: r20092: added a locking benchmark that should be good for benchmarking communitcation in a CIFS clustered server. It tries to keep the connections full by setting up the next lock as each lock is done. The locking pattern is similar to the local filesystem ping pong test in junkcode, forcing a communication between nodes on each request (This used to be commit d57b9fb29860bd03cfa970bcc52ef45d17775638) --- source4/torture/raw/lockbench.c | 196 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 source4/torture/raw/lockbench.c (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c new file mode 100644 index 0000000000..04a3f92c93 --- /dev/null +++ b/source4/torture/raw/lockbench.c @@ -0,0 +1,196 @@ +/* + Unix SMB/CIFS implementation. + + locking benchmark + + Copyright (C) Andrew Tridgell 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "torture/torture.h" +#include "libcli/raw/libcliraw.h" +#include "system/time.h" +#include "system/filesys.h" +#include "libcli/libcli.h" +#include "torture/util.h" +#include "lib/events/events.h" +#include "lib/cmdline/popt_common.h" + +#define CHECK_STATUS(status, correct) do { \ + if (!NT_STATUS_EQUAL(status, correct)) { \ + printf("(%s) Incorrect status %s - should be %s\n", \ + __location__, nt_errstr(status), nt_errstr(correct)); \ + goto failed; \ + }} while (0) + +#define BASEDIR "\\benchlock" +#define FNAME BASEDIR "\\lock.dat" + +static int nprocs; +static int lock_failed; + +struct benchlock_state { + struct smbcli_state *cli; + int fnum; + int offset; + int count; + union smb_lock io; + struct smb_lock_entry lock[2]; + struct smbcli_request *req; +}; + +static void lock_completion(struct smbcli_request *); + +/* + send the next lock request +*/ +static void lock_send(struct benchlock_state *state) +{ + state->io.lockx.in.file.fnum = state->fnum; + state->io.lockx.in.ulock_cnt = 1; + state->lock[0].pid = state->cli->session->pid; + state->lock[1].pid = state->cli->session->pid; + state->lock[0].offset = state->offset; + state->lock[1].offset = (state->offset+1)%nprocs; + state->req = smb_raw_lock_send(state->cli->tree, &state->io); + if (state->req == NULL) { + DEBUG(0,("Failed to setup lock\n")); + lock_failed++; + } + state->req->async.private = state; + state->req->async.fn = lock_completion; + state->offset = (state->offset+1)%nprocs; +} + +/* + called when a lock completes +*/ +static void lock_completion(struct smbcli_request *req) +{ + struct benchlock_state *state = (struct benchlock_state *)req->async.private; + NTSTATUS status = smbcli_request_simple_recv(req); + if (!NT_STATUS_IS_OK(status)) { + lock_failed++; + DEBUG(0,("Lock failed - %s\n", nt_errstr(status))); + } else { + state->count++; + lock_send(state); + } +} + +/* + benchmark locking calls +*/ +BOOL torture_bench_lock(struct torture_context *torture) +{ + BOOL ret = True; + TALLOC_CTX *mem_ctx = talloc_new(torture); + int i; + int timelimit = torture_setting_int(torture, "timelimit", 10); + struct timeval tv; + struct event_context *ev = event_context_find(mem_ctx); + struct benchlock_state *state; + int total = 0, loops=0; + NTSTATUS status; + + nprocs = lp_parm_int(-1, "torture", "nprocs", 4); + + state = talloc_zero_array(mem_ctx, struct benchlock_state, nprocs); + + printf("Opening %d connections\n", nprocs); + for (i=0;itree, + FNAME, + O_RDWR|O_CREAT, DENY_NONE); + if (state[i].fnum == -1) { + printf("Failed to open %s on connection %d\n", FNAME, i); + goto failed; + } + + state[i].io.lockx.level = RAW_LOCK_LOCKX; + state[i].io.lockx.in.mode = LOCKING_ANDX_LARGE_FILES; + state[i].io.lockx.in.timeout = 100000; + state[i].io.lockx.in.ulock_cnt = 0; + state[i].io.lockx.in.lock_cnt = 1; + state[i].lock[0].count = 1; + state[i].lock[1].count = 1; + state[i].io.lockx.in.locks = &state[i].lock[0]; + + state[i].offset = i; + state[i].io.lockx.in.file.fnum = state[i].fnum; + state[i].lock[0].offset = state[i].offset; + state[i].lock[0].pid = state[i].cli->session->pid; + status = smb_raw_lock(state[i].cli->tree, &state[i].io); + CHECK_STATUS(status, NT_STATUS_OK); + } + + for (i=0;isession); + } + + smbcli_deltree(state[0].cli->tree, BASEDIR); + talloc_free(mem_ctx); + return ret; + +failed: + for (i=0;isession); + } + smbcli_deltree(state[0].cli->tree, BASEDIR); + talloc_free(mem_ctx); + return False; +} -- cgit From 630733e9ef9241df1b4d62b9fa6f32c721f9bfad Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 19 Jan 2007 03:52:21 +0000 Subject: r20886: fixed a valgrind error (This used to be commit acc96e42e74005f1c381b0ab3f6c1b2e051ffaec) --- source4/torture/raw/lockbench.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 04a3f92c93..c3908124aa 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -83,6 +83,7 @@ static void lock_completion(struct smbcli_request *req) { struct benchlock_state *state = (struct benchlock_state *)req->async.private; NTSTATUS status = smbcli_request_simple_recv(req); + state->req = NULL; if (!NT_STATUS_IS_OK(status)) { lock_failed++; DEBUG(0,("Lock failed - %s\n", nt_errstr(status))); -- cgit From 0d60b9af90962e8db41fdc02cbda562297b1e6d4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 7 Feb 2007 07:11:20 +0000 Subject: r21216: fail the RAW-BENCH-LOCK test if the locking doesn't happen evenly across the connections (This used to be commit 01ef699981f3bcbbbdd4a47d9b85324aec783451) --- source4/torture/raw/lockbench.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index c3908124aa..4dbefd5d9b 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -105,7 +105,7 @@ BOOL torture_bench_lock(struct torture_context *torture) struct timeval tv; struct event_context *ev = event_context_find(mem_ctx); struct benchlock_state *state; - int total = 0, loops=0; + int total = 0, loops=0, minops=0; NTSTATUS status; nprocs = lp_parm_int(-1, "torture", "nprocs", 4); @@ -176,6 +176,15 @@ BOOL torture_bench_lock(struct torture_context *torture) } printf("%.2f ops/second\n", total/timeval_elapsed(&tv)); + minops = state[0].count; + for (i=0;i Date: Sun, 29 Apr 2007 21:37:29 +0000 Subject: r22579: disable progress printing in the build-farm metze (This used to be commit 93089ad5e8b6e20c4fa92bf13b0137765aeac689) --- source4/torture/raw/lockbench.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 4dbefd5d9b..3d02e0f5c4 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -171,8 +171,11 @@ BOOL torture_bench_lock(struct torture_context *torture) for (i=0;i Date: Mon, 14 May 2007 01:05:09 +0000 Subject: r22836: started adding auto-reconnect logic to lockbench. This needs to be made async. (This used to be commit 9e1ea3e09c80adb0b9809ee83e0c7b1ec9156e42) --- source4/torture/raw/lockbench.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 3d02e0f5c4..1621139aa7 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -44,7 +44,9 @@ static int nprocs; static int lock_failed; struct benchlock_state { + struct event_context *ev; struct smbcli_state *cli; + int client_num; int fnum; int offset; int count; @@ -76,6 +78,33 @@ static void lock_send(struct benchlock_state *state) state->offset = (state->offset+1)%nprocs; } +/* + reopen dead connections + */ +static void reopen_connection(struct benchlock_state *state) +{ + do { + DEBUG(0,("reopening connection %u\n", state->client_num)); + } while (!torture_open_connection_ev(&state->cli, state->client_num, state->ev)); + + state->fnum = smbcli_open(state->cli->tree, FNAME, O_RDWR|O_CREAT, DENY_NONE); + if (state->fnum == -1) { + printf("Failed to open %s on connection %d\n", FNAME, state->client_num); + exit(1); + } + + state->lock[0].offset = state->offset; + state->io.lockx.in.ulock_cnt = 0; + state->req = smb_raw_lock_send(state->cli->tree, &state->io); + if (state->req == NULL) { + DEBUG(0,("Failed to setup lock\n")); + lock_failed++; + } + state->req->async.private = state; + state->req->async.fn = lock_completion; + state->offset = (state->offset+1)%nprocs; +} + /* called when a lock completes */ @@ -87,6 +116,9 @@ static void lock_completion(struct smbcli_request *req) if (!NT_STATUS_IS_OK(status)) { lock_failed++; DEBUG(0,("Lock failed - %s\n", nt_errstr(status))); + if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { + reopen_connection(state); + } } else { state->count++; lock_send(state); @@ -114,6 +146,8 @@ BOOL torture_bench_lock(struct torture_context *torture) printf("Opening %d connections\n", nprocs); for (i=0;i Date: Mon, 14 May 2007 03:49:42 +0000 Subject: r22837: make RAW-BENCH-LOCK reconnect asynchronously when one of its servers goges away (This used to be commit cf0cdf5171d4e0ca01b697155ceb04ffc2863231) --- source4/torture/raw/lockbench.c | 138 ++++++++++++++++++++++++++++++++-------- 1 file changed, 110 insertions(+), 28 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 1621139aa7..705ab4d691 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -29,6 +29,8 @@ #include "torture/util.h" #include "lib/events/events.h" #include "lib/cmdline/popt_common.h" +#include "libcli/composite/composite.h" +#include "libcli/smb_composite/smb_composite.h" #define CHECK_STATUS(status, correct) do { \ if (!NT_STATUS_EQUAL(status, correct)) { \ @@ -45,7 +47,8 @@ static int lock_failed; struct benchlock_state { struct event_context *ev; - struct smbcli_state *cli; + struct smbcli_tree *tree; + TALLOC_CTX *mem_ctx; int client_num; int fnum; int offset; @@ -53,6 +56,13 @@ struct benchlock_state { union smb_lock io; struct smb_lock_entry lock[2]; struct smbcli_request *req; + struct smb_composite_connect reconnect; + + /* these are used for reconnections */ + int dest_port; + const char *dest_host; + const char *called_name; + const char *service_type; }; static void lock_completion(struct smbcli_request *); @@ -64,11 +74,11 @@ static void lock_send(struct benchlock_state *state) { state->io.lockx.in.file.fnum = state->fnum; state->io.lockx.in.ulock_cnt = 1; - state->lock[0].pid = state->cli->session->pid; - state->lock[1].pid = state->cli->session->pid; + state->lock[0].pid = state->tree->session->pid; + state->lock[1].pid = state->tree->session->pid; state->lock[0].offset = state->offset; state->lock[1].offset = (state->offset+1)%nprocs; - state->req = smb_raw_lock_send(state->cli->tree, &state->io); + state->req = smb_raw_lock_send(state->tree, &state->io); if (state->req == NULL) { DEBUG(0,("Failed to setup lock\n")); lock_failed++; @@ -78,24 +88,26 @@ static void lock_send(struct benchlock_state *state) state->offset = (state->offset+1)%nprocs; } -/* - reopen dead connections - */ -static void reopen_connection(struct benchlock_state *state) +static void reopen_connection(struct benchlock_state *state); + + +static void reopen_file(struct event_context *ev, struct timed_event *te, + struct timeval t, void *private_data) { - do { - DEBUG(0,("reopening connection %u\n", state->client_num)); - } while (!torture_open_connection_ev(&state->cli, state->client_num, state->ev)); - - state->fnum = smbcli_open(state->cli->tree, FNAME, O_RDWR|O_CREAT, DENY_NONE); + struct benchlock_state *state = (struct benchlock_state *)private_data; + + /* reestablish our open file */ + state->fnum = smbcli_open(state->tree, FNAME, O_RDWR|O_CREAT, DENY_NONE); if (state->fnum == -1) { printf("Failed to open %s on connection %d\n", FNAME, state->client_num); exit(1); } + /* reestablish one lock, preparing for the async lock loop */ state->lock[0].offset = state->offset; state->io.lockx.in.ulock_cnt = 0; - state->req = smb_raw_lock_send(state->cli->tree, &state->io); + state->io.lockx.in.file.fnum = state->fnum; + state->req = smb_raw_lock_send(state->tree, &state->io); if (state->req == NULL) { DEBUG(0,("Failed to setup lock\n")); lock_failed++; @@ -105,6 +117,70 @@ static void reopen_connection(struct benchlock_state *state) state->offset = (state->offset+1)%nprocs; } +/* + complete an async reconnect + */ +static void reopen_connection_complete(struct composite_context *ctx) +{ + struct benchlock_state *state = (struct benchlock_state *)ctx->async.private_data; + NTSTATUS status; + struct smb_composite_connect *io = &state->reconnect; + + status = smb_composite_connect_recv(ctx, state->mem_ctx); + if (!NT_STATUS_IS_OK(status)) { + reopen_connection(state); + return; + } + + talloc_free(state->tree); + state->tree = io->out.tree; + + /* do the reopen as a separate event */ + event_add_timed(state->ev, state->mem_ctx, timeval_zero(), reopen_file, state); +} + + + +/* + reopen dead connections + */ +static void reopen_connection(struct benchlock_state *state) +{ + struct composite_context *ctx; + struct smb_composite_connect *io = &state->reconnect; + char *host, *share; + + if (!torture_get_conn_index(state->client_num, state->mem_ctx, &host, &share)) { + DEBUG(0,("Can't find host/share for reconnect?!\n")); + exit(1); + } + + io->in.dest_host = state->dest_host; + io->in.port = state->dest_port; + io->in.called_name = state->called_name; + io->in.service = share; + io->in.service_type = state->service_type; + io->in.credentials = cmdline_credentials; + io->in.fallback_to_anonymous = False; + io->in.workgroup = lp_workgroup(); + + DEBUG(0,("reopening connection to //%s/%s\n", host, share)); + + /* kill off the remnants of the old connection */ + talloc_free(state->tree); + state->tree = NULL; + + ctx = smb_composite_connect_send(io, state->mem_ctx, state->ev); + if (ctx == NULL) { + DEBUG(0,("Failed to setup async reconnect\n")); + exit(1); + } + + ctx->async.fn = reopen_connection_complete; + ctx->async.private_data = state; +} + + /* called when a lock completes */ @@ -114,10 +190,11 @@ static void lock_completion(struct smbcli_request *req) NTSTATUS status = smbcli_request_simple_recv(req); state->req = NULL; if (!NT_STATUS_IS_OK(status)) { - lock_failed++; - DEBUG(0,("Lock failed - %s\n", nt_errstr(status))); if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { reopen_connection(state); + } else { + DEBUG(0,("Lock failed - %s\n", nt_errstr(status))); + lock_failed++; } } else { state->count++; @@ -139,6 +216,7 @@ BOOL torture_bench_lock(struct torture_context *torture) struct benchlock_state *state; int total = 0, loops=0, minops=0; NTSTATUS status; + struct smbcli_state *cli; nprocs = lp_parm_int(-1, "torture", "nprocs", 4); @@ -146,20 +224,29 @@ BOOL torture_bench_lock(struct torture_context *torture) printf("Opening %d connections\n", nprocs); for (i=0;itree; + state[i].dest_host = talloc_strdup(state[i].mem_ctx, + cli->tree->session->transport->socket->hostname); + state[i].dest_port = cli->tree->session->transport->socket->port; + state[i].called_name = talloc_strdup(state[i].mem_ctx, + cli->tree->session->transport->called.name); + state[i].service_type = talloc_strdup(state[i].mem_ctx, + cli->tree->device); } - if (!torture_setup_dir(state[0].cli, BASEDIR)) { + if (!torture_setup_dir(cli, BASEDIR)) { goto failed; } for (i=0;itree, + state[i].fnum = smbcli_open(state[i].tree, FNAME, O_RDWR|O_CREAT, DENY_NONE); if (state[i].fnum == -1) { @@ -179,8 +266,8 @@ BOOL torture_bench_lock(struct torture_context *torture) state[i].offset = i; state[i].io.lockx.in.file.fnum = state[i].fnum; state[i].lock[0].offset = state[i].offset; - state[i].lock[0].pid = state[i].cli->session->pid; - status = smb_raw_lock(state[i].cli->tree, &state[i].io); + state[i].lock[0].pid = state[i].tree->session->pid; + status = smb_raw_lock(state[i].tree, &state[i].io); CHECK_STATUS(status, NT_STATUS_OK); } @@ -226,19 +313,14 @@ BOOL torture_bench_lock(struct torture_context *torture) for (i=0;isession); + smb_raw_exit(state[i].tree->session); } - smbcli_deltree(state[0].cli->tree, BASEDIR); + smbcli_deltree(state[0].tree, BASEDIR); talloc_free(mem_ctx); return ret; failed: - for (i=0;isession); - } - smbcli_deltree(state[0].cli->tree, BASEDIR); talloc_free(mem_ctx); return False; } -- cgit From 2e11a2b60181cff1fd9fc9716563ae77e18db10c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 15 May 2007 03:00:58 +0000 Subject: r22876: - try to reconnect once per second, not continously - patch from ronnie to fix the lock offset on reconnect (This used to be commit 77d7ca5590bfc416a2526bc8833158df4e9d7810) --- source4/torture/raw/lockbench.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 705ab4d691..d399a4f3f2 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -88,7 +88,8 @@ static void lock_send(struct benchlock_state *state) state->offset = (state->offset+1)%nprocs; } -static void reopen_connection(struct benchlock_state *state); +static void reopen_connection(struct event_context *ev, struct timed_event *te, + struct timeval t, void *private_data); static void reopen_file(struct event_context *ev, struct timed_event *te, @@ -114,7 +115,6 @@ static void reopen_file(struct event_context *ev, struct timed_event *te, } state->req->async.private = state; state->req->async.fn = lock_completion; - state->offset = (state->offset+1)%nprocs; } /* @@ -128,7 +128,9 @@ static void reopen_connection_complete(struct composite_context *ctx) status = smb_composite_connect_recv(ctx, state->mem_ctx); if (!NT_STATUS_IS_OK(status)) { - reopen_connection(state); + event_add_timed(state->ev, state->mem_ctx, + timeval_current_ofs(1,0), + reopen_connection, state); return; } @@ -142,10 +144,12 @@ static void reopen_connection_complete(struct composite_context *ctx) /* - reopen dead connections + reopen a connection */ -static void reopen_connection(struct benchlock_state *state) +static void reopen_connection(struct event_context *ev, struct timed_event *te, + struct timeval t, void *private_data) { + struct benchlock_state *state = (struct benchlock_state *)private_data; struct composite_context *ctx; struct smb_composite_connect *io = &state->reconnect; char *host, *share; @@ -191,7 +195,9 @@ static void lock_completion(struct smbcli_request *req) state->req = NULL; if (!NT_STATUS_IS_OK(status)) { if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { - reopen_connection(state); + event_add_timed(state->ev, state->mem_ctx, + timeval_current_ofs(1,0), + reopen_connection, state); } else { DEBUG(0,("Lock failed - %s\n", nt_errstr(status))); lock_failed++; -- cgit From 3173a3cee6e7b85e0822e21306c5612467dfd5e2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 15 May 2007 05:42:16 +0000 Subject: r22881: show number of connected clients (This used to be commit 42f6c5106ea4d0e35f88e0c9523cbd13206fecb5) --- source4/torture/raw/lockbench.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index d399a4f3f2..d603878450 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -44,6 +44,7 @@ static int nprocs; static int lock_failed; +static int num_connected; struct benchlock_state { struct event_context *ev; @@ -115,6 +116,11 @@ static void reopen_file(struct event_context *ev, struct timed_event *te, } state->req->async.private = state; state->req->async.fn = lock_completion; + + num_connected++; + + DEBUG(0,("reconnect to %s finished (%u connected)\n", state->dest_host, + num_connected)); } /* @@ -168,8 +174,6 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, io->in.fallback_to_anonymous = False; io->in.workgroup = lp_workgroup(); - DEBUG(0,("reopening connection to //%s/%s\n", host, share)); - /* kill off the remnants of the old connection */ talloc_free(state->tree); state->tree = NULL; @@ -195,6 +199,10 @@ static void lock_completion(struct smbcli_request *req) state->req = NULL; if (!NT_STATUS_IS_OK(status)) { if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { + talloc_free(state->tree); + state->tree = NULL; + num_connected--; + DEBUG(0,("reopening connection to %s\n", state->dest_host)); event_add_timed(state->ev, state->mem_ctx, timeval_current_ofs(1,0), reopen_connection, state); @@ -247,6 +255,8 @@ BOOL torture_bench_lock(struct torture_context *torture) cli->tree->device); } + num_connected = i; + if (!torture_setup_dir(cli, BASEDIR)) { goto failed; } -- cgit From e9eb862dc0cb100bf2ee3de367a20587346f85aa Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 17 May 2007 02:22:29 +0000 Subject: r22962: show progress separately for each client in RAW-BENCH-LOCK, this is much more useful for seeing why we get unbalanced locking (This used to be commit 1f1f57023b6d7d7d4938803e57f30e485ccba719) --- source4/torture/raw/lockbench.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index d603878450..690ac85f17 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -54,6 +54,7 @@ struct benchlock_state { int fnum; int offset; int count; + int lastcount; union smb_lock io; struct smb_lock_entry lock[2]; struct smbcli_request *req; @@ -216,6 +217,22 @@ static void lock_completion(struct smbcli_request *req) } } + +static void report_rate(struct event_context *ev, struct timed_event *te, + struct timeval t, void *private_data) +{ + struct benchlock_state *state = talloc_get_type(private_data, + struct benchlock_state); + int i; + for (i=0;i Date: Thu, 17 May 2007 03:42:28 +0000 Subject: r22965: changed RAW-LOCK-BENCH to remove the scheduling uncertainty. We should always get balanced locking now (This used to be commit 4e6df7b9b1938b91a904ab061c36d65b169f93a8) --- source4/torture/raw/lockbench.c | 112 +++++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 52 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 690ac85f17..508ef88864 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -32,13 +32,6 @@ #include "libcli/composite/composite.h" #include "libcli/smb_composite/smb_composite.h" -#define CHECK_STATUS(status, correct) do { \ - if (!NT_STATUS_EQUAL(status, correct)) { \ - printf("(%s) Incorrect status %s - should be %s\n", \ - __location__, nt_errstr(status), nt_errstr(correct)); \ - goto failed; \ - }} while (0) - #define BASEDIR "\\benchlock" #define FNAME BASEDIR "\\lock.dat" @@ -46,17 +39,19 @@ static int nprocs; static int lock_failed; static int num_connected; +enum lock_stage {LOCK_INITIAL, LOCK_LOCK, LOCK_UNLOCK}; + struct benchlock_state { struct event_context *ev; struct smbcli_tree *tree; TALLOC_CTX *mem_ctx; int client_num; int fnum; - int offset; + enum lock_stage stage; + int lock_offset; + int unlock_offset; int count; int lastcount; - union smb_lock io; - struct smb_lock_entry lock[2]; struct smbcli_request *req; struct smb_composite_connect reconnect; @@ -74,20 +69,47 @@ static void lock_completion(struct smbcli_request *); */ static void lock_send(struct benchlock_state *state) { - state->io.lockx.in.file.fnum = state->fnum; - state->io.lockx.in.ulock_cnt = 1; - state->lock[0].pid = state->tree->session->pid; - state->lock[1].pid = state->tree->session->pid; - state->lock[0].offset = state->offset; - state->lock[1].offset = (state->offset+1)%nprocs; - state->req = smb_raw_lock_send(state->tree, &state->io); + union smb_lock io; + struct smb_lock_entry lock; + + switch (state->stage) { + case LOCK_INITIAL: + io.lockx.in.ulock_cnt = 0; + io.lockx.in.lock_cnt = 1; + state->lock_offset = 0; + state->unlock_offset = 0; + lock.offset = state->lock_offset; + break; + case LOCK_LOCK: + io.lockx.in.ulock_cnt = 0; + io.lockx.in.lock_cnt = 1; + state->lock_offset = (state->lock_offset+1)%(nprocs+1); + lock.offset = state->lock_offset; + break; + case LOCK_UNLOCK: + io.lockx.in.ulock_cnt = 1; + io.lockx.in.lock_cnt = 0; + lock.offset = state->unlock_offset; + state->unlock_offset = (state->unlock_offset+1)%(nprocs+1); + break; + } + + lock.count = 1; + lock.pid = state->tree->session->pid; + + io.lockx.level = RAW_LOCK_LOCKX; + io.lockx.in.mode = LOCKING_ANDX_LARGE_FILES; + io.lockx.in.timeout = 100000; + io.lockx.in.locks = &lock; + io.lockx.in.file.fnum = state->fnum; + + state->req = smb_raw_lock_send(state->tree, &io); if (state->req == NULL) { DEBUG(0,("Failed to setup lock\n")); lock_failed++; } state->req->async.private = state; state->req->async.fn = lock_completion; - state->offset = (state->offset+1)%nprocs; } static void reopen_connection(struct event_context *ev, struct timed_event *te, @@ -106,22 +128,13 @@ static void reopen_file(struct event_context *ev, struct timed_event *te, exit(1); } - /* reestablish one lock, preparing for the async lock loop */ - state->lock[0].offset = state->offset; - state->io.lockx.in.ulock_cnt = 0; - state->io.lockx.in.file.fnum = state->fnum; - state->req = smb_raw_lock_send(state->tree, &state->io); - if (state->req == NULL) { - DEBUG(0,("Failed to setup lock\n")); - lock_failed++; - } - state->req->async.private = state; - state->req->async.fn = lock_completion; - num_connected++; DEBUG(0,("reconnect to %s finished (%u connected)\n", state->dest_host, num_connected)); + + state->stage = LOCK_INITIAL; + lock_send(state); } /* @@ -211,10 +224,23 @@ static void lock_completion(struct smbcli_request *req) DEBUG(0,("Lock failed - %s\n", nt_errstr(status))); lock_failed++; } - } else { - state->count++; - lock_send(state); + return; + } + + switch (state->stage) { + case LOCK_INITIAL: + state->stage = LOCK_LOCK; + break; + case LOCK_LOCK: + state->stage = LOCK_UNLOCK; + break; + case LOCK_UNLOCK: + state->stage = LOCK_LOCK; + break; } + + state->count++; + lock_send(state); } @@ -246,7 +272,6 @@ BOOL torture_bench_lock(struct torture_context *torture) struct event_context *ev = event_context_find(mem_ctx); struct benchlock_state *state; int total = 0, minops=0; - NTSTATUS status; struct smbcli_state *cli; bool progress; @@ -290,24 +315,7 @@ BOOL torture_bench_lock(struct torture_context *torture) goto failed; } - state[i].io.lockx.level = RAW_LOCK_LOCKX; - state[i].io.lockx.in.mode = LOCKING_ANDX_LARGE_FILES; - state[i].io.lockx.in.timeout = 100000; - state[i].io.lockx.in.ulock_cnt = 0; - state[i].io.lockx.in.lock_cnt = 1; - state[i].lock[0].count = 1; - state[i].lock[1].count = 1; - state[i].io.lockx.in.locks = &state[i].lock[0]; - - state[i].offset = i; - state[i].io.lockx.in.file.fnum = state[i].fnum; - state[i].lock[0].offset = state[i].offset; - state[i].lock[0].pid = state[i].tree->session->pid; - status = smb_raw_lock(state[i].tree, &state[i].io); - CHECK_STATUS(status, NT_STATUS_OK); - } - - for (i=0;i Date: Fri, 25 May 2007 10:43:06 +0000 Subject: r23139: use echo operations once a second in lockbench and openbench to ensure we detect IP takeover on servers (This used to be commit b5292a25edf1c071dea19877fb6b31f2501132ef) --- source4/torture/raw/lockbench.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 508ef88864..7ec8844cdc 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -257,6 +257,16 @@ static void report_rate(struct event_context *ev, struct timed_event *te, printf("\r"); fflush(stdout); event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state); + + /* send an echo on each interface to ensure it stays alive - this helps + with IP takeover */ + for (i=0;isession->transport, &p); + } } /* -- cgit From d79225c94a8322dd89cb8e4adb3619165920a4c6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 25 May 2007 11:39:43 +0000 Subject: r23140: send send echos while disconnected (This used to be commit 233172a9f71e297e255c393946ad51fad96b356e) --- source4/torture/raw/lockbench.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 7ec8844cdc..901b7dee7e 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -265,7 +265,9 @@ static void report_rate(struct event_context *ev, struct timed_event *te, p.in.repeat_count = 0; p.in.size = 0; p.in.data = NULL; - smb_raw_echo_send(state[i].tree->session->transport, &p); + if (state[i].tree) { + smb_raw_echo_send(state[i].tree->session->transport, &p); + } } } -- cgit From a085d682e664ff76ec33d65c71bcbcdc99697e74 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 25 May 2007 12:21:29 +0000 Subject: r23142: added error checking and reconnect on echo replies (This used to be commit 0d47efe6d6d1738183c59942a077faaf1c77f004) --- source4/torture/raw/lockbench.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 901b7dee7e..2197ccc010 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -244,6 +244,22 @@ static void lock_completion(struct smbcli_request *req) } +static void echo_completion(struct smbcli_request *req) +{ + struct benchlock_state *state = talloc_get_type(req->async.private, + struct benchlock_state); + NTSTATUS status = smbcli_request_simple_recv(req); + if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { + talloc_free(state->tree); + state->tree = NULL; + num_connected--; + DEBUG(0,("reopening connection to %s\n", state->dest_host)); + event_add_timed(state->ev, state->mem_ctx, + timeval_current_ofs(1,0), + reopen_connection, state); + } +} + static void report_rate(struct event_context *ev, struct timed_event *te, struct timeval t, void *private_data) { @@ -258,16 +274,21 @@ static void report_rate(struct event_context *ev, struct timed_event *te, fflush(stdout); event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state); + if (!state[i].tree) { + return; + } + /* send an echo on each interface to ensure it stays alive - this helps with IP takeover */ for (i=0;isession->transport, &p); - } + req = smb_raw_echo_send(state[i].tree->session->transport, &p); + req->async.private = state; + req->async.fn = echo_completion; } } -- cgit From d142f4b0f28edf10b9a0f1653d2fcbf31c45b296 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 25 May 2007 12:35:03 +0000 Subject: r23143: error found by valgrind (This used to be commit 268a26131ee43a673e7b79a359b2575dcef554d5) --- source4/torture/raw/lockbench.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 2197ccc010..361f509c40 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -274,15 +274,16 @@ static void report_rate(struct event_context *ev, struct timed_event *te, fflush(stdout); event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state); - if (!state[i].tree) { - return; - } - /* send an echo on each interface to ensure it stays alive - this helps with IP takeover */ for (i=0;i Date: Tue, 29 May 2007 07:32:28 +0000 Subject: r23180: auto-reconnect on both NT_STATUS_END_OF_FILE and NT_STATUS_LOCAL_DISCONNECT (This used to be commit 32a6c268a7963382dc05f53783ac22f7fd0de429) --- source4/torture/raw/lockbench.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 361f509c40..e929218ead 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -212,7 +212,8 @@ static void lock_completion(struct smbcli_request *req) NTSTATUS status = smbcli_request_simple_recv(req); state->req = NULL; if (!NT_STATUS_IS_OK(status)) { - if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { + if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE) || + NT_STATUS_EQUAL(status, NT_STATUS_LOCAL_DISCONNECT)) { talloc_free(state->tree); state->tree = NULL; num_connected--; @@ -249,7 +250,8 @@ static void echo_completion(struct smbcli_request *req) struct benchlock_state *state = talloc_get_type(req->async.private, struct benchlock_state); NTSTATUS status = smbcli_request_simple_recv(req); - if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { + if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE) || + NT_STATUS_EQUAL(status, NT_STATUS_LOCAL_DISCONNECT)) { talloc_free(state->tree); state->tree = NULL; num_connected--; -- cgit From aeac4f48001bbca61b9f94ecb1bdfa336ff27ad7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 29 May 2007 08:22:45 +0000 Subject: r23181: prevent attempts to reopen the connection twice at the same time (This used to be commit a25c27dbae4534f2125001c16ac9ae0b67c519cb) --- source4/torture/raw/lockbench.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index e929218ead..af0c65b6a4 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -54,6 +54,7 @@ struct benchlock_state { int lastcount; struct smbcli_request *req; struct smb_composite_connect reconnect; + struct timed_event *te; /* these are used for reconnections */ int dest_port; @@ -148,9 +149,10 @@ static void reopen_connection_complete(struct composite_context *ctx) status = smb_composite_connect_recv(ctx, state->mem_ctx); if (!NT_STATUS_IS_OK(status)) { - event_add_timed(state->ev, state->mem_ctx, - timeval_current_ofs(1,0), - reopen_connection, state); + talloc_free(state->te); + state->te = event_add_timed(state->ev, state->mem_ctx, + timeval_current_ofs(1,0), + reopen_connection, state); return; } @@ -218,9 +220,10 @@ static void lock_completion(struct smbcli_request *req) state->tree = NULL; num_connected--; DEBUG(0,("reopening connection to %s\n", state->dest_host)); - event_add_timed(state->ev, state->mem_ctx, - timeval_current_ofs(1,0), - reopen_connection, state); + talloc_free(state->te); + state->te = event_add_timed(state->ev, state->mem_ctx, + timeval_current_ofs(1,0), + reopen_connection, state); } else { DEBUG(0,("Lock failed - %s\n", nt_errstr(status))); lock_failed++; @@ -256,9 +259,10 @@ static void echo_completion(struct smbcli_request *req) state->tree = NULL; num_connected--; DEBUG(0,("reopening connection to %s\n", state->dest_host)); - event_add_timed(state->ev, state->mem_ctx, - timeval_current_ofs(1,0), - reopen_connection, state); + talloc_free(state->te); + state->te = event_add_timed(state->ev, state->mem_ctx, + timeval_current_ofs(1,0), + reopen_connection, state); } } -- cgit From 95a3ca53e57548501c0b66919c2b952121541e83 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 29 May 2007 08:30:41 +0000 Subject: r23182: fixed valgrind error (This used to be commit fae416cbe8e44bc88ea709160a583e2f921e4eec) --- source4/torture/raw/lockbench.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index af0c65b6a4..5e132a24cc 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -176,6 +176,8 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, struct smb_composite_connect *io = &state->reconnect; char *host, *share; + state->te = NULL; + if (!torture_get_conn_index(state->client_num, state->mem_ctx, &host, &share)) { DEBUG(0,("Can't find host/share for reconnect?!\n")); exit(1); -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/torture/raw/lockbench.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 5e132a24cc..168131a6d2 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From 489d23e808e8a5a90ac2a6c57160bd6c6a651690 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 21 Aug 2007 01:16:04 +0000 Subject: r24585: put in the right state variable when doing a SMBecho - this caused the wrong connection to reconnect on a SMBecho failure (This used to be commit c61415b05ddd29c7214384189f7d0ddabdaa3b71) --- source4/torture/raw/lockbench.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 168131a6d2..6908fbeef9 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -295,7 +295,7 @@ static void report_rate(struct event_context *ev, struct timed_event *te, p.in.size = 0; p.in.data = NULL; req = smb_raw_echo_send(state[i].tree->session->transport, &p); - req->async.private = state; + req->async.private = &state[i]; req->async.fn = echo_completion; } } -- cgit From 51aced3dc86c42e98d9b59db73331a5231854e1c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 21 Aug 2007 01:25:15 +0000 Subject: r24587: the elements of the array are not talloc pointers (This used to be commit 2ebf00dc42edfc3474dc88ef2e560d4b1b534efa) --- source4/torture/raw/lockbench.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 6908fbeef9..ce90944b1d 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -251,8 +251,7 @@ static void lock_completion(struct smbcli_request *req) static void echo_completion(struct smbcli_request *req) { - struct benchlock_state *state = talloc_get_type(req->async.private, - struct benchlock_state); + struct benchlock_state *state = (struct benchlock_state *)req->async.private; NTSTATUS status = smbcli_request_simple_recv(req); if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE) || NT_STATUS_EQUAL(status, NT_STATUS_LOCAL_DISCONNECT)) { -- cgit From f96b1778a42d8388fd1c6384cd7c90b6e4bcd437 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 26 Aug 2007 19:58:40 +0000 Subject: r24674: Make sure results are always on a new line, fix typo in test name. (This used to be commit 40c1635b39b4acff0acecc734583daa0217215ce) --- source4/torture/raw/lockbench.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index ce90944b1d..44b60b8695 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -393,9 +393,10 @@ BOOL torture_bench_lock(struct torture_context *torture) smbcli_deltree(state[0].tree, BASEDIR); talloc_free(mem_ctx); + printf("\n"); return ret; failed: talloc_free(mem_ctx); - return False; + return false; } -- cgit From ffeee68e4b72dd94fee57366bd8d38b8c284c3d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 12:42:09 +0000 Subject: r25026: Move param/param.h out of includes.h (This used to be commit abe8349f9b4387961ff3665d8c589d61cd2edf31) --- source4/torture/raw/lockbench.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 44b60b8695..6ef33be759 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -30,6 +30,7 @@ #include "lib/cmdline/popt_common.h" #include "libcli/composite/composite.h" #include "libcli/smb_composite/smb_composite.h" +#include "param/param.h" #define BASEDIR "\\benchlock" #define FNAME BASEDIR "\\lock.dat" -- cgit From 98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 16:46:30 +0000 Subject: r25035: Fix some more warnings, use service pointer rather than service number in more places. (This used to be commit df9cebcb97e20564359097148665bd519f31bc6f) --- source4/torture/raw/lockbench.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 6ef33be759..55cab9e117 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -318,7 +318,7 @@ BOOL torture_bench_lock(struct torture_context *torture) progress = torture_setting_bool(torture, "progress", true); - nprocs = lp_parm_int(-1, "torture", "nprocs", 4); + nprocs = lp_parm_int(NULL, "torture", "nprocs", 4); state = talloc_zero_array(mem_ctx, struct benchlock_state, nprocs); -- cgit From 37d53832a4623653f706e77985a79d84bd7c6694 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 28 Sep 2007 01:17:46 +0000 Subject: r25398: Parse loadparm context to all lp_*() functions. (This used to be commit 3fcc960839c6e5ca4de2c3c042f12f369ac5f238) --- source4/torture/raw/lockbench.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 55cab9e117..97509606c3 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -190,7 +190,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, io->in.service_type = state->service_type; io->in.credentials = cmdline_credentials; io->in.fallback_to_anonymous = False; - io->in.workgroup = lp_workgroup(); + io->in.workgroup = lp_workgroup(global_loadparm); /* kill off the remnants of the old connection */ talloc_free(state->tree); -- cgit From 60a1046c5c5783799bd64fe18e03534670f83d82 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 29 Sep 2007 18:00:19 +0000 Subject: r25430: Add the loadparm context to all parametric options. (This used to be commit fd697d77c9fe67a00939a1f04b35c451316fff58) --- source4/torture/raw/lockbench.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 97509606c3..d55a0a012e 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -318,7 +318,7 @@ BOOL torture_bench_lock(struct torture_context *torture) progress = torture_setting_bool(torture, "progress", true); - nprocs = lp_parm_int(NULL, "torture", "nprocs", 4); + nprocs = lp_parm_int(global_loadparm, NULL, "torture", "nprocs", 4); state = talloc_zero_array(mem_ctx, struct benchlock_state, nprocs); -- cgit From 2151cde58014ea2e822c13d2f8a369b45dc19ca8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 6 Oct 2007 22:28:14 +0000 Subject: r25554: Convert last instances of BOOL, True and False to the standard types. (This used to be commit 566aa14139510788548a874e9213d91317f83ca9) --- source4/torture/raw/lockbench.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index d55a0a012e..855364b169 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -189,7 +189,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, io->in.service = share; io->in.service_type = state->service_type; io->in.credentials = cmdline_credentials; - io->in.fallback_to_anonymous = False; + io->in.fallback_to_anonymous = false; io->in.workgroup = lp_workgroup(global_loadparm); /* kill off the remnants of the old connection */ @@ -303,9 +303,9 @@ static void report_rate(struct event_context *ev, struct timed_event *te, /* benchmark locking calls */ -BOOL torture_bench_lock(struct torture_context *torture) +bool torture_bench_lock(struct torture_context *torture) { - BOOL ret = True; + bool ret = true; TALLOC_CTX *mem_ctx = talloc_new(torture); int i; int timelimit = torture_setting_int(torture, "timelimit", 10); @@ -328,7 +328,7 @@ BOOL torture_bench_lock(struct torture_context *torture) state[i].client_num = i; state[i].ev = ev; if (!torture_open_connection_ev(&cli, i, ev)) { - return False; + return false; } talloc_steal(mem_ctx, state); state[i].tree = cli->tree; -- cgit From bbdfbf8d9d486aee51117976b8f825759a4c4a37 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 00:28:22 +0100 Subject: r26238: Add a loadparm context parameter to torture_context, remove more uses of global_loadparm. (This used to be commit a33a5530545086b81a3b205aa109dff11c546926) --- source4/torture/raw/lockbench.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 855364b169..633264ce0a 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -318,7 +318,7 @@ bool torture_bench_lock(struct torture_context *torture) progress = torture_setting_bool(torture, "progress", true); - nprocs = lp_parm_int(global_loadparm, NULL, "torture", "nprocs", 4); + nprocs = torture_setting_int(torture, "nprocs", 4); state = talloc_zero_array(mem_ctx, struct benchlock_state, nprocs); -- cgit From 0a2f1a46a02d2c9497d05d7e534829dc6e9430dc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 15:53:07 +0100 Subject: r26249: Remove a couple more uses of global_loadparm. (This used to be commit 80a61200508a00d5b16a3e748ce92d54b9fefcd2) --- source4/torture/raw/lockbench.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 633264ce0a..81016fc563 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -42,6 +42,7 @@ static int num_connected; enum lock_stage {LOCK_INITIAL, LOCK_LOCK, LOCK_UNLOCK}; struct benchlock_state { + struct torture_context *tctx; struct event_context *ev; struct smbcli_tree *tree; TALLOC_CTX *mem_ctx; @@ -178,7 +179,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, state->te = NULL; - if (!torture_get_conn_index(state->client_num, state->mem_ctx, &host, &share)) { + if (!torture_get_conn_index(state->client_num, state->mem_ctx, state->tctx, &host, &share)) { DEBUG(0,("Can't find host/share for reconnect?!\n")); exit(1); } @@ -324,10 +325,11 @@ bool torture_bench_lock(struct torture_context *torture) printf("Opening %d connections\n", nprocs); for (i=0;i Date: Mon, 3 Dec 2007 15:53:17 +0100 Subject: r26250: Avoid global_loadparm in a couple more places. (This used to be commit 2c6b755309fdf685cd0b0564272bf83038574a43) --- source4/torture/raw/lockbench.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 81016fc563..113634f264 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -191,7 +191,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, io->in.service_type = state->service_type; io->in.credentials = cmdline_credentials; io->in.fallback_to_anonymous = false; - io->in.workgroup = lp_workgroup(global_loadparm); + io->in.workgroup = lp_workgroup(state->tctx->lp_ctx); /* kill off the remnants of the old connection */ talloc_free(state->tree); -- cgit From 4b0199a5493ea2b88558cc40871e63c1dc8dbb56 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 12 Dec 2007 02:15:29 +0100 Subject: r26409: Pass smb ports along. (This used to be commit 2833f320de1f1fd39c710ad0a61c3fa1bb1df31f) --- source4/torture/raw/lockbench.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 113634f264..744aab66b1 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -185,7 +185,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, } io->in.dest_host = state->dest_host; - io->in.port = state->dest_port; + io->in.dest_ports = state->dest_port; io->in.called_name = state->called_name; io->in.service = share; io->in.service_type = state->service_type; -- cgit From 771b347f9b185895390445be96081c781e28a26d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Jan 2008 18:39:01 -0600 Subject: r26644: Janitorial: Pass resolve_context explicitly to various SMB functions, should help fix the build for OpenChange. (This used to be commit 385ffe4f4cc9a21a760c0f00410f56e2592fd507) --- source4/torture/raw/lockbench.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 744aab66b1..9131128f81 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -30,6 +30,7 @@ #include "lib/cmdline/popt_common.h" #include "libcli/composite/composite.h" #include "libcli/smb_composite/smb_composite.h" +#include "libcli/resolve/resolve.h" #include "param/param.h" #define BASEDIR "\\benchlock" @@ -197,7 +198,9 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, talloc_free(state->tree); state->tree = NULL; - ctx = smb_composite_connect_send(io, state->mem_ctx, state->ev); + ctx = smb_composite_connect_send(io, state->mem_ctx, + lp_resolve_context(state->tctx->lp_ctx), + state->ev); if (ctx == NULL) { DEBUG(0,("Failed to setup async reconnect\n")); exit(1); -- cgit From 969b8579c755441092e27b499ecedbd7d725816d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Jan 2008 18:39:15 -0600 Subject: r26646: libcli/smb_composite: Allow specifying SMB parameters in smb_composite_connect structure. AFAIK no global variables will now be used when doing RPC client connections. (This used to be commit 0ef75e4e3cb0e1bd10e367a00f5e9b725587c40a) --- source4/torture/raw/lockbench.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 9131128f81..28392880d7 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -193,6 +193,12 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, io->in.credentials = cmdline_credentials; io->in.fallback_to_anonymous = false; io->in.workgroup = lp_workgroup(state->tctx->lp_ctx); + io->in.max_xmit = lp_max_xmit(state->tctx->lp_ctx); + io->in.max_mux = lp_maxmux(state->tctx->lp_ctx); + io->in.ntstatus_support = lp_nt_status_support(state->tctx->lp_ctx); + io->in.max_protocol = lp_cli_maxprotocol(state->tctx->lp_ctx); + io->in.unicode = lp_unicode(state->tctx->lp_ctx); + io->in.use_spnego = lp_use_spnego(state->tctx->lp_ctx) && lp_nt_status_support(state->tctx->lp_ctx); /* kill off the remnants of the old connection */ talloc_free(state->tree); -- cgit From 5d0e4f2147d4d1d0104d55756e91ffc13d25c1f3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 3 Jan 2008 17:21:50 -0600 Subject: r26650: torture/raw: Fix warnings in lockbench/openbench. I'm surprised this didn't cause any breakages. We should probably run (a subset of) RAW-LOCKBENCH + RAW-OPENBENCH in make test to make sure they don't regress. (This used to be commit 9bea9c0c4f62dabaaad4c56e7e55da96571b1e1d) --- source4/torture/raw/lockbench.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 28392880d7..ea570e5bf5 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -59,7 +59,7 @@ struct benchlock_state { struct timed_event *te; /* these are used for reconnections */ - int dest_port; + const char **dest_ports; const char *dest_host; const char *called_name; const char *service_type; @@ -186,7 +186,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, } io->in.dest_host = state->dest_host; - io->in.dest_ports = state->dest_port; + io->in.dest_ports = state->dest_ports; io->in.called_name = state->called_name; io->in.service = share; io->in.service_type = state->service_type; @@ -345,7 +345,12 @@ bool torture_bench_lock(struct torture_context *torture) state[i].tree = cli->tree; state[i].dest_host = talloc_strdup(state[i].mem_ctx, cli->tree->session->transport->socket->hostname); - state[i].dest_port = cli->tree->session->transport->socket->port; + state[i].dest_ports = talloc_array(state[i].mem_ctx, + const char *, 2); + state[i].dest_ports[0] = talloc_asprintf(state[i].dest_ports, + "%u", + cli->tree->session->transport->socket->port); + state[i].dest_ports[1] = NULL; state[i].called_name = talloc_strdup(state[i].mem_ctx, cli->tree->session->transport->called.name); state[i].service_type = talloc_strdup(state[i].mem_ctx, -- cgit From 425732f688865ebe2bfe568c8278edec50cbdedf Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 3 Jan 2008 17:21:58 -0600 Subject: r26651: libsmb: Allow specifying signing policy from higher up. The number of arguments is getting a bit excessive now, so it probably makes sense to pass in the smbcli_options struct rather than all members individually and add a convenience function for obtaining a smbcli_options struct from a loadparm context. (This used to be commit 9f64213463b5bf3bcbf36913139e9a5042e967a2) --- source4/torture/raw/lockbench.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index ea570e5bf5..5093816a31 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -199,6 +199,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, io->in.max_protocol = lp_cli_maxprotocol(state->tctx->lp_ctx); io->in.unicode = lp_unicode(state->tctx->lp_ctx); io->in.use_spnego = lp_use_spnego(state->tctx->lp_ctx) && lp_nt_status_support(state->tctx->lp_ctx); + io->in.signing = lp_client_signing(state->tctx->lp_ctx); /* kill off the remnants of the old connection */ talloc_free(state->tree); -- cgit From dcc282590b34537fc1ead61c3300172528273b44 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 3 Jan 2008 17:22:12 -0600 Subject: r26654: libcli/smb_composite: Rather than specifying each of the gazillion options for SMB individually, just specify the smbcli_options struct. (This used to be commit 8a97886e24a4b969aa91409c06f423b71a45f6eb) --- source4/torture/raw/lockbench.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 5093816a31..16e9f0ec75 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -193,13 +193,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, io->in.credentials = cmdline_credentials; io->in.fallback_to_anonymous = false; io->in.workgroup = lp_workgroup(state->tctx->lp_ctx); - io->in.max_xmit = lp_max_xmit(state->tctx->lp_ctx); - io->in.max_mux = lp_maxmux(state->tctx->lp_ctx); - io->in.ntstatus_support = lp_nt_status_support(state->tctx->lp_ctx); - io->in.max_protocol = lp_cli_maxprotocol(state->tctx->lp_ctx); - io->in.unicode = lp_unicode(state->tctx->lp_ctx); - io->in.use_spnego = lp_use_spnego(state->tctx->lp_ctx) && lp_nt_status_support(state->tctx->lp_ctx); - io->in.signing = lp_client_signing(state->tctx->lp_ctx); + lp_smbcli_options(state->tctx->lp_ctx, &io->in.options); /* kill off the remnants of the old connection */ talloc_free(state->tree); -- cgit From afe3e8172ddaa5e4aa811faceecda4f943d6e2ef Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 04:53:27 +0200 Subject: Install public header files again and include required prototypes. (This used to be commit 47ffbbf67435904754469544390b67d34c958343) --- source4/torture/raw/lockbench.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 16e9f0ec75..86030c538a 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -22,6 +22,7 @@ #include "includes.h" #include "torture/torture.h" #include "libcli/raw/libcliraw.h" +#include "libcli/raw/raw_proto.h" #include "system/time.h" #include "system/filesys.h" #include "libcli/libcli.h" -- cgit From 06d06c6c9415140167708d09307125067c1f5b87 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 01:19:20 +0200 Subject: Use provided event context rather than looking for it. (This used to be commit fd0bb96acea3d7949cf0574bb6f3568a90f67f4e) --- source4/torture/raw/lockbench.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 86030c538a..d7738be833 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -316,7 +316,6 @@ bool torture_bench_lock(struct torture_context *torture) int i; int timelimit = torture_setting_int(torture, "timelimit", 10); struct timeval tv; - struct event_context *ev = event_context_find(mem_ctx); struct benchlock_state *state; int total = 0, minops=0; struct smbcli_state *cli; @@ -333,8 +332,8 @@ bool torture_bench_lock(struct torture_context *torture) state[i].tctx = torture; state[i].mem_ctx = talloc_new(state); state[i].client_num = i; - state[i].ev = ev; - if (!torture_open_connection_ev(&cli, i, torture, ev)) { + state[i].ev = torture->ev; + if (!torture_open_connection_ev(&cli, i, torture, torture->ev)) { return false; } talloc_steal(mem_ctx, state); @@ -380,7 +379,7 @@ bool torture_bench_lock(struct torture_context *torture) printf("Running for %d seconds\n", timelimit); while (timeval_elapsed(&tv) < timelimit) { - event_loop_once(ev); + event_loop_once(torture->ev); if (lock_failed) { DEBUG(0,("locking failed\n")); -- cgit From 9de0594175f9ccd9c130a332126f9247758c43ad Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 01:30:21 +0200 Subject: Fix the build. (This used to be commit 40b7b0e503cff31ea4e3d4822f2263fbeb76c57a) --- source4/torture/raw/lockbench.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/raw/lockbench.c') diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index d7738be833..21541d003b 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -374,7 +374,7 @@ bool torture_bench_lock(struct torture_context *torture) tv = timeval_current(); if (progress) { - event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state); + event_add_timed(torture->ev, state, timeval_current_ofs(1, 0), report_rate, state); } printf("Running for %d seconds\n", timelimit); -- cgit