The branch, master has been updated via 69c2e18 selftest: we fail the smb2.durable-open.delete_on_close2 test via a4358f6 s4:torture:smb2: add a durable-open.delete_on_close2 test via 675871f selftest: pass smb2.durable-open.delete_on_close1 via f244b29 selftest: smb2.durable-open.delete_on_close1 is not flapping any more via 3d7196d s4:torture:smb2: fix the durable-open.delete_on_close1 test via d237427 lib/replace: remove duplicate check for inotify from b657668 docs: Move idmap manpage to there old location.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 69c2e18865ca3cfa8fe1558e43253a74521b2d65 Author: Michael Adam <ob...@samba.org> Date: Tue Sep 11 14:13:51 2012 +0200 selftest: we fail the smb2.durable-open.delete_on_close2 test (we currently do not grant durable on reconnect when delete-on-close is set) Autobuild-User(master): Michael Adam <ob...@samba.org> Autobuild-Date(master): Tue Sep 11 16:22:20 CEST 2012 on sn-devel-104 commit a4358f6ffdd1f4c31393c574244ba3883568f88d Author: Michael Adam <ob...@samba.org> Date: Tue Sep 11 14:08:28 2012 +0200 s4:torture:smb2: add a durable-open.delete_on_close2 test This test verifies that the delete on close flag is kept during a disconnect and is still active on the reconnected handle. When the reconnected handle is closed, the file is deleted. commit 675871f7a763cf9b22ff1ee7ef871e8cf9bb3b9e Author: Michael Adam <ob...@samba.org> Date: Tue Sep 11 13:07:21 2012 +0200 selftest: pass smb2.durable-open.delete_on_close1 commit f244b299498648901d82d80d6ba42b7561d4e436 Author: Michael Adam <ob...@samba.org> Date: Tue Sep 11 13:06:22 2012 +0200 selftest: smb2.durable-open.delete_on_close1 is not flapping any more The entry into flapping was not effective anyways since, the test was also listed in knownfail... commit 3d7196d0a470d31a531a618f210cd60635361daf Author: Michael Adam <ob...@samba.org> Date: Tue Sep 11 13:43:17 2012 +0200 s4:torture:smb2: fix the durable-open.delete_on_close1 test This test used to flap because there was an invalid check of the file-id. This might or might not be the same after a new open. Hence the flapping. The new version simply opens a file as durable handle with delete_on_close set, writes a byte and closes the file. Then on a new connect, the file is opened again, and it is checked that the file has been created (again) and that it is empty. commit d237427f18b02958cfcfd6d775ee52231b3d095f Author: Michael Adam <ob...@samba.org> Date: Tue Sep 11 12:49:14 2012 +0200 lib/replace: remove duplicate check for inotify ----------------------------------------------------------------------- Summary of changes: lib/replace/wscript | 2 +- selftest/flapping | 1 - selftest/knownfail | 2 +- source4/torture/smb2/durable_open.c | 171 +++++++++++++++++++++++++---------- 4 files changed, 124 insertions(+), 52 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/replace/wscript b/lib/replace/wscript index 3dbbd2a..2f632e1 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -65,7 +65,7 @@ def configure(conf): conf.CHECK_HEADERS('libintl.h errno.h') conf.CHECK_HEADERS('gcrypt.h getopt.h iconv.h') conf.CHECK_HEADERS('sys/inotify.h memory.h nss.h sasl/sasl.h') - conf.CHECK_HEADERS('security/pam_appl.h sys/inotify.h zlib.h asm/unistd.h') + conf.CHECK_HEADERS('security/pam_appl.h zlib.h asm/unistd.h') conf.CHECK_HEADERS('aio.h sys/unistd.h rpc/rpc.h rpc/nettype.h alloca.h float.h') conf.CHECK_HEADERS('rpcsvc/nis.h rpcsvc/ypclnt.h sys/prctl.h sys/sysctl.h') diff --git a/selftest/flapping b/selftest/flapping index cce6a9a..f0b1528 100644 --- a/selftest/flapping +++ b/selftest/flapping @@ -24,4 +24,3 @@ ^samba3.raw.samba3checkfsp.samba3checkfsp\(plugin_s4_dc\) # Seems to flap - succeeds on sn-devel, fails on Fedora 16 ^samba3.raw.samba3closeerr.samba3closeerr\(plugin_s4_dc\) # Seems to flap - succeeds on sn-devel, fails on Fedora 16 ^samba4.nss.test.*using.*winbind # fails sometimes on sn-devel -^samba3.smb2.durable-open.delete_on_close1 # another intermittent failure diff --git a/selftest/knownfail b/selftest/knownfail index 094b2a4..0180eb3 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -177,7 +177,7 @@ ^samba3.smb2.notify.rec ^samba3.smb2.durable-open.lock-lease ^samba3.smb2.durable-open.reopen4 -^samba3.smb2.durable-open.delete_on_close1 +^samba3.smb2.durable-open.delete_on_close2 ^samba3.smb2.durable-v2-open.open-lease ^samba3.smb2.durable-v2-open.persistent-open-lease ^samba3.smb2.ioctl.shadow_copy diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c index 1cf183b..d625852 100644 --- a/source4/torture/smb2/durable_open.c +++ b/source4/torture/smb2/durable_open.c @@ -722,12 +722,9 @@ bool test_durable_open_delete_on_close1(struct torture_context *tctx, char fname[256]; struct smb2_handle _h; struct smb2_handle *h = NULL; - struct smb2_create io1, io2, io3; + struct smb2_create io1, io2; bool ret = true; - struct smb2_transport *transport; - struct smb2_session *session2; - struct smb2_tree *tree2; - union smb_fileinfo info1, info2; + uint8_t b = 0; /* Choose a random name in case the state is left a little funky. */ snprintf(fname, 256, "durable_open_delete_on_close1_%s.dat", @@ -749,80 +746,154 @@ bool test_durable_open_delete_on_close1(struct torture_context *tctx, CHECK_VAL(io1.out.durable_open, true); CHECK_VAL(io1.out.oplock_level, smb2_util_oplock_level("b")); - ZERO_STRUCT(info1); - info1.internal_information.level = RAW_FILEINFO_INTERNAL_INFORMATION; - info1.internal_information.in.file.handle = _h; - status = smb2_getinfo_file(tree, tree, &info1); + status = smb2_util_write(tree, *h, &b, 0, 1); CHECK_STATUS(status, NT_STATUS_OK); - /* - * do a session logoff, establish a new session and tree - * connect on the same transport, and try a durable reopen - */ - transport = tree->session->transport; - status = smb2_logoff(tree->session); - CHECK_STATUS(status, NT_STATUS_OK); + /* disconnect, leaving the durable handle in place */ + TALLOC_FREE(tree); - if (!torture_smb2_session_setup(tctx, transport, - 0, /* previous_session_id */ - mem_ctx, &session2)) - { - torture_warning(tctx, "session setup failed.\n"); + if (!torture_smb2_connection(tctx, &tree)) { + torture_warning(tctx, "could not reconnect, bailing\n"); ret = false; goto done; } /* - * the session setup has talloc-stolen the transport, - * so we can safely free the old tree+session for clarity + * Open the file on the new connection again + * and check that it has been newly created, + * i.e. delete on close was effective on the disconnected handle. + * Also check that the file is really empty, + * the previously written byte gone. */ - TALLOC_FREE(tree); - - if (!torture_smb2_tree_connect(tctx, session2, mem_ctx, &tree2)) { - torture_warning(tctx, "tree connect failed.\n"); - ret = false; - goto done; - } - - ZERO_STRUCT(io3); - io3.in.fname = fname; - io3.in.durable_handle = h; - h = NULL; - smb2_oplock_create_share(&io2, fname, smb2_util_share_access(""), smb2_util_oplock_level("b")); io2.in.create_options |= NTCREATEX_OPTIONS_DELETE_ON_CLOSE; - status = smb2_create(tree2, mem_ctx, &io2); + status = smb2_create(tree, mem_ctx, &io2); CHECK_STATUS(status, NT_STATUS_OK); _h = io2.out.file.handle; h = &_h; - CHECK_CREATED(&io2, CREATED, FILE_ATTRIBUTE_ARCHIVE); + CHECK_CREATED_SIZE(&io2, CREATED, FILE_ATTRIBUTE_ARCHIVE, 0, 0); CHECK_VAL(io2.out.durable_open, false); CHECK_VAL(io2.out.oplock_level, smb2_util_oplock_level("b")); - ZERO_STRUCT(info2); - info2.internal_information.level = RAW_FILEINFO_INTERNAL_INFORMATION; - info2.internal_information.in.file.handle = _h; - status = smb2_getinfo_file(tree2, tree2, &info2); +done: + if (h != NULL) { + smb2_util_close(tree, *h); + } + + smb2_util_unlink(tree, fname); + + talloc_free(tree); + + talloc_free(mem_ctx); + + return ret; +} + + +bool test_durable_open_delete_on_close2(struct torture_context *tctx, + struct smb2_tree *tree) +{ + NTSTATUS status; + TALLOC_CTX *mem_ctx = talloc_new(tctx); + char fname[256]; + struct smb2_handle _h; + struct smb2_handle *h = NULL; + struct smb2_create io; + bool ret = true; + uint8_t b = 0; + uint64_t previous_session_id; + uint64_t alloc_size_step; + + /* Choose a random name in case the state is left a little funky. */ + snprintf(fname, 256, "durable_open_delete_on_close2_%s.dat", + generate_random_str(tctx, 8)); + + smb2_util_unlink(tree, fname); + + smb2_oplock_create_share(&io, fname, + smb2_util_share_access(""), + smb2_util_oplock_level("b")); + io.in.durable_open = true; + io.in.create_options |= NTCREATEX_OPTIONS_DELETE_ON_CLOSE; + + status = smb2_create(tree, mem_ctx, &io); CHECK_STATUS(status, NT_STATUS_OK); + _h = io.out.file.handle; + h = &_h; + CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE); + CHECK_VAL(io.out.durable_open, true); + CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b")); - CHECK_NOT_VAL(info1.internal_information.out.file_id, - info2.internal_information.out.file_id); + status = smb2_util_write(tree, *h, &b, 0, 1); + CHECK_STATUS(status, NT_STATUS_OK); - status = smb2_create(tree2, mem_ctx, &io3); - CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); + previous_session_id = smb2cli_session_current_id(tree->session->smbXcli); + + /* disconnect, leaving the durable handle in place */ + TALLOC_FREE(tree); + + if (!torture_smb2_connection_ext(tctx, previous_session_id, &tree)) { + torture_warning(tctx, "could not reconnect, bailing\n"); + ret = false; + goto done; + } + + ZERO_STRUCT(io); + io.in.fname = fname; + io.in.durable_handle = h; + + status = smb2_create(tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + _h = io.out.file.handle; + h = &_h; + alloc_size_step = io.out.alloc_size; + CHECK_CREATED_SIZE(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE, alloc_size_step, 1); + CHECK_VAL(io.out.durable_open, false); + CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b")); + + /* close the file, thereby deleting it */ + smb2_util_close(tree, *h); + status = smb2_logoff(tree->session); + TALLOC_FREE(tree); + + if (!torture_smb2_connection(tctx, &tree)) { + torture_warning(tctx, "could not reconnect, bailing\n"); + ret = false; + goto done; + } + + /* + * Open the file on the new connection again + * and check that it has been newly created, + * i.e. delete on close was effective on the reconnected handle. + * Also check that the file is really empty, + * the previously written byte gone. + */ + smb2_oplock_create_share(&io, fname, + smb2_util_share_access(""), + smb2_util_oplock_level("b")); + io.in.durable_open = true; + io.in.create_options |= NTCREATEX_OPTIONS_DELETE_ON_CLOSE; + + status = smb2_create(tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + _h = io.out.file.handle; + h = &_h; + CHECK_CREATED_SIZE(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE, 0, 0); + CHECK_VAL(io.out.durable_open, true); + CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b")); done: if (h != NULL) { - smb2_util_close(tree2, *h); + smb2_util_close(tree, *h); } - smb2_util_unlink(tree2, fname); + smb2_util_unlink(tree, fname); talloc_free(tree); - talloc_free(tree2); talloc_free(mem_ctx); @@ -1634,6 +1705,8 @@ struct torture_suite *torture_smb2_durable_open_init(void) torture_suite_add_1smb2_test(suite, "reopen4", test_durable_open_reopen4); torture_suite_add_1smb2_test(suite, "delete_on_close1", test_durable_open_delete_on_close1); + torture_suite_add_1smb2_test(suite, "delete_on_close2", + test_durable_open_delete_on_close2); torture_suite_add_1smb2_test(suite, "file-position", test_durable_open_file_position); torture_suite_add_2smb2_test(suite, "oplock", test_durable_open_oplock); -- Samba Shared Repository