The branch, master has been updated via ebb776f selftest: Add tests for vfs_aio_fork via e79ed4f s3-vfs: Make vfs_aio_fork erratic timing behaviour a run-time option from a817959 build: Create bin/ when doing 'waf dist' from a fresh checkout
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit ebb776f51f697ece62ed5c7ee6aa4865397347c2 Author: Andrew Bartlett <abart...@samba.org> Date: Tue Aug 21 19:22:54 2012 +1000 selftest: Add tests for vfs_aio_fork Autobuild-User(master): Andrew Bartlett <abart...@samba.org> Autobuild-Date(master): Tue Aug 21 13:12:33 CEST 2012 on sn-devel-104 commit e79ed4fe72208e632cd980d4adec07f1c78f1511 Author: Andrew Bartlett <abart...@samba.org> Date: Tue Aug 21 19:22:37 2012 +1000 s3-vfs: Make vfs_aio_fork erratic timing behaviour a run-time option This will allow this to be tested as part of a normal selftest. Andrew Bartlett ----------------------------------------------------------------------- Summary of changes: selftest/target/Samba3.pm | 8 ++++++ source3/modules/vfs_aio_fork.c | 49 +++++++++++++++++++++++++++++++++++---- source3/selftest/tests.py | 4 +++ 3 files changed, 56 insertions(+), 5 deletions(-) Changeset truncated at 500 lines: diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index 31bd15b..cb11827 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -344,10 +344,18 @@ sub setup_secshare($$) print "PROVISIONING server with security=share..."; + my $prefix_abs = abs_path($path); + my $secshare_options = " security = share lanman auth = yes vfs objects = $vfs_modulesdir_abs/xattr_tdb.so $vfs_modulesdir_abs/streams_depot.so + +[vfs_aio_fork] + path = $prefix_abs/share + vfs objects = $vfs_modulesdir_abs/aio_fork.so + read only = no + vfs_aio_fork:erratic_testing_mode=yes "; my $vars = $self->provision($path, diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c index 811d44e..2ec3d3d 100644 --- a/source3/modules/vfs_aio_fork.c +++ b/source3/modules/vfs_aio_fork.c @@ -33,6 +33,10 @@ #define MAP_FILE 0 #endif +struct aio_fork_config { + bool erratic_testing_mode; +}; + struct mmap_area { size_t size; volatile void *ptr; @@ -112,6 +116,7 @@ struct rw_cmd { size_t n; off_t offset; enum cmd_type cmd; + bool erratic_testing_mode; }; struct rw_ret { @@ -355,8 +360,7 @@ static void aio_child_loop(int sockfd, struct mmap_area *map) cmd_type_str(cmd_struct.cmd), (int)cmd_struct.n, (int)cmd_struct.offset, fd)); -#ifdef DEVELOPER - { + if (cmd_struct.erratic_testing_mode) { /* * For developer testing, we want erratic behaviour for * async I/O times @@ -372,8 +376,6 @@ static void aio_child_loop(int sockfd, struct mmap_area *map) DEBUG(10, ("delaying for %u msecs\n", msecs)); smb_msleep(msecs); } -#endif - ZERO_STRUCT(ret_struct); @@ -587,6 +589,10 @@ static struct tevent_req *aio_fork_pread_send(struct vfs_handle_struct *handle, struct rw_cmd cmd; ssize_t written; int err; + struct aio_fork_config *config; + SMB_VFS_HANDLE_GET_DATA(handle, config, + struct aio_fork_config, + return -1); req = tevent_req_create(mem_ctx, &state, struct aio_fork_pread_state); if (req == NULL) { @@ -609,6 +615,7 @@ static struct tevent_req *aio_fork_pread_send(struct vfs_handle_struct *handle, cmd.n = n; cmd.offset = offset; cmd.cmd = READ_CMD; + cmd.erratic_testing_mode = config->erratic_testing_mode; DEBUG(10, ("sending fd %d to child %d\n", fsp->fh->fd, (int)state->child->pid)); @@ -698,6 +705,10 @@ static struct tevent_req *aio_fork_pwrite_send( struct rw_cmd cmd; ssize_t written; int err; + struct aio_fork_config *config; + SMB_VFS_HANDLE_GET_DATA(handle, config, + struct aio_fork_config, + return NULL); req = tevent_req_create(mem_ctx, &state, struct aio_fork_pwrite_state); if (req == NULL) { @@ -720,6 +731,7 @@ static struct tevent_req *aio_fork_pwrite_send( cmd.n = n; cmd.offset = offset; cmd.cmd = WRITE_CMD; + cmd.erratic_testing_mode = config->erratic_testing_mode; DEBUG(10, ("sending fd %d to child %d\n", fsp->fh->fd, (int)state->child->pid)); @@ -808,6 +820,10 @@ static struct tevent_req *aio_fork_fsync_send( struct rw_cmd cmd; ssize_t written; int err; + struct aio_fork_config *config; + SMB_VFS_HANDLE_GET_DATA(handle, config, + struct aio_fork_config, + return -1); req = tevent_req_create(mem_ctx, &state, struct aio_fork_fsync_state); if (req == NULL) { @@ -822,6 +838,7 @@ static struct tevent_req *aio_fork_fsync_send( ZERO_STRUCT(cmd); cmd.cmd = FSYNC_CMD; + cmd.erratic_testing_mode = config->erratic_testing_mode; DEBUG(10, ("sending fd %d to child %d\n", fsp->fh->fd, (int)state->child->pid)); @@ -896,6 +913,28 @@ static int aio_fork_fsync_recv(struct tevent_req *req, int *err) static int aio_fork_connect(vfs_handle_struct *handle, const char *service, const char *user) { + int ret; + struct aio_fork_config *config; + ret = SMB_VFS_NEXT_CONNECT(handle, service, user); + + if (ret < 0) { + return ret; + } + + config = talloc_zero(handle->conn, struct aio_fork_config); + if (!config) { + SMB_VFS_NEXT_DISCONNECT(handle); + DEBUG(0, ("talloc_zero() failed\n")); + return -1; + } + + config->erratic_testing_mode = lp_parm_bool(SNUM(handle->conn), "vfs_aio_fork", + "erratic_testing_mode", false); + + SMB_VFS_HANDLE_SET_DATA(handle, config, + NULL, struct aio_fork_config, + return -1); + /********************************************************************* * How many threads to initialize ? * 100 per process seems insane as a default until you realize that @@ -907,7 +946,7 @@ static int aio_fork_connect(vfs_handle_struct *handle, const char *service, * says different. *********************************************************************/ aio_pending_size = 100; - return SMB_VFS_NEXT_CONNECT(handle, service, user); + return 0; } static struct vfs_fn_pointers vfs_aio_fork_fns = { diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index f9f2e22..2e13ca0 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -102,6 +102,10 @@ for t in tests: plantestsuite("samba3.smbtorture_s3.crypt_server(s3dc).%s" % t, "s3dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmpenc', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"]) plantestsuite("samba3.smbtorture_s3.plain(dc).%s" % t, "dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmp', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"]) +tests = ["RW1", "RW2", "RW3"] +for t in tests: + plantestsuite("samba3.smbtorture_s3.vfs_aio_fork(secshare).%s" % t, "secshare", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/vfs_aio_fork', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"]) + posix_tests=[ "POSIX", "POSIX-APPEND"] for t in posix_tests: -- Samba Shared Repository