The branch, master has been updated via 0c54e7c s4:torture/smb2: add smb2.durable-open.lock-oplock via ff36ce7 selftest: samba3.smb2.durable-open.lock => samba3.smb2.durable-open.lock-lease via 7d8db45 s4:torture/smb2: rename smb2.durable-open.lock to smb2.durable-open.lock-lease from 732f28b autobuild: run "samba3-ctdb" by default
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 0c54e7c93627963401a1deec1e0bd1c65bdeea00 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Jun 22 00:28:26 2012 +0200 s4:torture/smb2: add smb2.durable-open.lock-oplock metze Autobuild-User(master): Stefan Metzmacher <me...@samba.org> Autobuild-Date(master): Fri Jun 22 03:37:54 CEST 2012 on sn-devel-104 commit ff36ce74c0b9fea54b50bfdbc5d77a94e7759830 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jun 21 23:06:08 2012 +0200 selftest: samba3.smb2.durable-open.lock => samba3.smb2.durable-open.lock-lease metze commit 7d8db45028083f52341c05a9927d662fc2da7fe5 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jun 21 12:10:09 2012 +0200 s4:torture/smb2: rename smb2.durable-open.lock to smb2.durable-open.lock-lease metze ----------------------------------------------------------------------- Summary of changes: selftest/knownfail | 3 +- source4/torture/smb2/durable_open.c | 87 +++++++++++++++++++++++++++++++++-- 2 files changed, 85 insertions(+), 5 deletions(-) Changeset truncated at 500 lines: diff --git a/selftest/knownfail b/selftest/knownfail index f08b4d1..16fd77c 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -152,7 +152,8 @@ ^samba3.smb2.notify.rec ^samba3.smb2.durable-open.file-position ^samba3.smb2.durable-open.lease -^samba3.smb2.durable-open.lock +^samba3.smb2.durable-open.lock-oplock +^samba3.smb2.durable-open.lock-lease ^samba3.smb2.durable-open.open ^samba3.smb2.durable-open.reopen1 ^samba3.smb2.durable-open.reopen2 diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c index 7e55052..659fa9d 100644 --- a/source4/torture/smb2/durable_open.c +++ b/source4/torture/smb2/durable_open.c @@ -1106,11 +1106,89 @@ bool test_durable_open_lease(struct torture_context *tctx, return ret; } +bool test_durable_open_lock_oplock(struct torture_context *tctx, + struct smb2_tree *tree) +{ + TALLOC_CTX *mem_ctx = talloc_new(tctx); + struct smb2_create io; + struct smb2_handle h; + struct smb2_lock lck; + struct smb2_lock_element el[2]; + NTSTATUS status; + char fname[256]; + bool ret = true; + + /* + */ + snprintf(fname, 256, "durable_open_oplock_lock_%s.dat", generate_random_str(tctx, 8)); + + /* Clean slate */ + smb2_util_unlink(tree, fname); + + /* Create with lease */ + + smb2_oplock_create_share(&io, fname, + smb2_util_share_access(""), + smb2_util_oplock_level("b")); + io.in.durable_open = true; + + status = smb2_create(tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + h = io.out.file.handle; + 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")); + + ZERO_STRUCT(lck); + ZERO_STRUCT(el); + lck.in.locks = el; + lck.in.lock_count = 0x0001; + lck.in.lock_sequence = 0x00000000; + lck.in.file.handle = h; + el[0].offset = 0; + el[0].length = 1; + el[0].reserved = 0x00000000; + el[0].flags = SMB2_LOCK_FLAG_EXCLUSIVE; + status = smb2_lock(tree, &lck); + CHECK_STATUS(status, NT_STATUS_OK); + + /* Disconnect/Reconnect. */ + talloc_free(tree); + tree = NULL; + + if (!torture_smb2_connection(tctx, &tree)) { + torture_warning(tctx, "couldn't 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; + + lck.in.file.handle = h; + el[0].flags = SMB2_LOCK_FLAG_UNLOCK; + status = smb2_lock(tree, &lck); + CHECK_STATUS(status, NT_STATUS_OK); + + done: + smb2_util_close(tree, h); + smb2_util_unlink(tree, fname); + talloc_free(tree); + + return ret; +} + /* Open, take BRL, disconnect, reconnect. */ -bool test_durable_open_lock(struct torture_context *tctx, - struct smb2_tree *tree) +bool test_durable_open_lock_lease(struct torture_context *tctx, + struct smb2_tree *tree) { TALLOC_CTX *mem_ctx = talloc_new(tctx); struct smb2_create io; @@ -1134,7 +1212,7 @@ bool test_durable_open_lock(struct torture_context *tctx, * little funky. */ lease = random(); - snprintf(fname, 256, "durable_open_lock_%s.dat", generate_random_str(tctx, 8)); + snprintf(fname, 256, "durable_open_lease_lock_%s.dat", generate_random_str(tctx, 8)); /* Clean slate */ smb2_util_unlink(tree, fname); @@ -1401,7 +1479,8 @@ struct torture_suite *torture_smb2_durable_open_init(void) test_durable_open_file_position); torture_suite_add_2smb2_test(suite, "oplock", test_durable_open_oplock); torture_suite_add_2smb2_test(suite, "lease", test_durable_open_lease); - torture_suite_add_1smb2_test(suite, "lock", test_durable_open_lock); + torture_suite_add_1smb2_test(suite, "lock-oplock", test_durable_open_lock_oplock); + torture_suite_add_1smb2_test(suite, "lock-lease", test_durable_open_lock_lease); torture_suite_add_2smb2_test(suite, "open2-lease", test_durable_open_open2_lease); torture_suite_add_2smb2_test(suite, "open2-oplock", -- Samba Shared Repository