The branch, master has been updated via 5c85776... s4 selftest/quicktest: Update known failures for the sfileinfo and oplock changes via 15e1c61... s4 torture: Add a new RAW-OPLOCK test: BATCH26 via 8f7e573... s4 torture: Close the third handle in RAW-OPLOCK-BATCH22 via 522d6bc... s4 torture: Convert an error to a warning in RAW-OPLOCK-BATCH22 via b14da4f... s4 torture: Add a few more windows target types via fc78326... s4 torture: Convert to a more modern version of read in RAW-OPLOCK-BATCH4 via af8b785... s4 torture: Allow some implementations to break from level1 to none with two breaks from 66c9687... Make sure we're not using the old smb_fname data.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 5c857768d1415c4e70a9b7a96b8a9de1ec8efdee Author: Tim Prouty <tpro...@samba.org> Date: Thu Dec 3 17:01:53 2009 -0800 s4 selftest/quicktest: Update known failures for the sfileinfo and oplock changes Two new samba4 bugs have been filed for the two corresponding known failures. For the short term raw.sfileinfo had to be removed from quicktest. It is no longer an individual test, but a test-suite and quicktest can only run top level tests. commit 15e1c610273766a548a28b4d8731c6e9bad4496e Author: Tim Prouty <tpro...@samba.org> Date: Thu Dec 3 13:46:11 2009 -0800 s4 torture: Add a new RAW-OPLOCK test: BATCH26 Try a rename with a wide-open share mode on an already open file and the there is still share mode contention. For the reason why see: http://social.msdn.microsoft.com/Forums/en-US/os_fileservices/thread/3ca14dc9-da1f-4786-a8f7-a86e9903db0c Msft's anser: After further review, The reason for server to fail with sharing violation is that the windows server that executes a path-based rename request opens the file for DELETE access, but only with FILE_SHARED_READ as ShareAccess . Therefore, the existing open(frame 76), which has shared read/write/delete , is compatible with the Windows servers access mode (DELETE), but Windows servers open is not compatible with access mode in existing open. Note that it is correct to state that the logic in Windows server could have been written to allow shared read/write/delete in which case it would succeed as you mention. The behavior here is historical based on the existing implementation. commit 8f7e5732ef3accd833906276f4a13891bac26726 Author: Tim Prouty <tpro...@samba.org> Date: Thu Dec 3 13:16:18 2009 -0800 s4 torture: Close the third handle in RAW-OPLOCK-BATCH22 commit 522d6bc58891b8c25e935bcee3206f03c8ab73cb Author: Tim Prouty <tpro...@samba.org> Date: Wed Dec 2 18:39:05 2009 -0800 s4 torture: Convert an error to a warning in RAW-OPLOCK-BATCH22 Some servers choose to mark a client as bad if they fail an oplock break request by timing out (win7 is an example). Once the client is marked as bad, future oplock requests will timeout instantly. This causes subsequent runs of this test to fail, so rather than erroring out as a failure, a warning is printed instead. There is also a bug in w2k3 where it was incorrectly returning contending a share mode lock. It worked in XP and has been re-fixed in win7. This can also now be run against samba3. commit b14da4f7c54e88e615f2bb19bec43bacb7f11de8 Author: Tim Prouty <tpro...@samba.org> Date: Tue Dec 1 16:27:10 2009 -0800 s4 torture: Add a few more windows target types commit fc7832602d149dee61ff003902bc5f54cd0de0f2 Author: Tim Prouty <tpro...@samba.org> Date: Fri Nov 20 11:25:43 2009 -0800 s4 torture: Convert to a more modern version of read in RAW-OPLOCK-BATCH4 commit af8b7857ca4b9f81d2240d2592c4d02893b04f76 Author: Tim Prouty <tpro...@samba.org> Date: Tue Dec 1 15:29:00 2009 -0800 s4 torture: Allow some implementations to break from level1 to none with two breaks ----------------------------------------------------------------------- Summary of changes: source4/selftest/knownfail | 2 + source4/selftest/quick | 1 - source4/torture/raw/oplock.c | 186 ++++++++++++++++++++++++++++++++++++------ source4/torture/smbtorture.c | 6 ++ source4/torture/smbtorture.h | 6 ++ source4/torture/util.h | 2 + 6 files changed, 176 insertions(+), 27 deletions(-) Changeset truncated at 500 lines: diff --git a/source4/selftest/knownfail b/source4/selftest/knownfail index 56bf718..b9d40f2 100644 --- a/source4/selftest/knownfail +++ b/source4/selftest/knownfail @@ -65,3 +65,5 @@ samba4.base.createx_access # this test is broken for non-administrator users samba4.smb2.oplock # oplocks in the s4 SMB2 server are a mess samba4.raw.lock.*.async # bug 6960 samba4.smb2.lock.*.MULTIPLE-UNLOCK # bug 6959 +samba4.raw.sfileinfo.*.END-OF-FILE # bug 6962 +samba4.raw.oplock.*.BATCH22 # bug 6963 diff --git a/source4/selftest/quick b/source4/selftest/quick index 38098a9..ff409ce 100644 --- a/source4/selftest/quick +++ b/source4/selftest/quick @@ -11,7 +11,6 @@ base.open base.chkpath raw.qfsinfo raw.qfileinfo -raw.sfileinfo raw.mkdir raw.seek raw.open diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c index 283fed2..78987e3 100644 --- a/source4/torture/raw/oplock.c +++ b/source4/torture/raw/oplock.c @@ -34,11 +34,11 @@ ret = false; \ }} while (0) -#define CHECK_RANGE(v, min, max) do { \ - if ((v) < (min) || (v) > (max)) { \ - torture_result(tctx, TORTURE_FAIL, "(%s): wrong value for %s got %d - should be between %d and %d\n", \ - __location__, #v, (int)v, (int)min, (int)max); \ - ret = false; \ +#define CHECK_RANGE(v, min, max) do { \ + if ((v) < (min) || (v) > (max)) { \ + torture_warning(tctx, "(%s): wrong value for %s got " \ + "%d - should be between %d and %d\n", \ + __location__, #v, (int)v, (int)min, (int)max); \ }} while (0) #define CHECK_STRMATCH(v, correct) do { \ @@ -253,6 +253,12 @@ done: return; } +static uint8_t get_break_level1_to_none_count(struct torture_context *tctx) +{ + return torture_setting_bool(tctx, "2_step_break_to_none", false) ? + 2 : 1; +} + static bool test_raw_oplock_exclusive1(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2) { const char *fname = BASEDIR "\\test_exclusive1.dat"; @@ -471,7 +477,7 @@ static bool test_raw_oplock_exclusive3(struct torture_context *tctx, struct smbc CHECK_STATUS(tctx, status, NT_STATUS_OK); torture_wait_for_oplock_break(tctx); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_NONE); @@ -608,7 +614,7 @@ static bool test_raw_oplock_exclusive5(struct torture_context *tctx, struct smbc fnum2 = io.ntcreatex.out.file.fnum; CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN); torture_wait_for_oplock_break(tctx); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); smbcli_close(cli1->tree, fnum); @@ -967,11 +973,13 @@ static bool test_raw_oplock_batch4(struct torture_context *tctx, struct smbcli_s fnum = io.ntcreatex.out.file.fnum; CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN); - rd.read.level = RAW_READ_READ; - rd.read.in.file.fnum = fnum; - rd.read.in.count = 1; - rd.read.in.offset = 0; - rd.read.in.remaining = 0; + rd.readx.level = RAW_READ_READX; + rd.readx.in.file.fnum = fnum; + rd.readx.in.mincnt = 1; + rd.readx.in.maxcnt = 1; + rd.readx.in.offset = 0; + rd.readx.in.remaining = 0; + rd.readx.in.read_for_execute = false; status = smb_raw_read(cli1->tree, &rd); CHECK_STATUS(tctx, status, NT_STATUS_OK); torture_wait_for_oplock_break(tctx); @@ -1538,7 +1546,7 @@ static bool test_raw_oplock_batch11(struct torture_context *tctx, struct smbcli_ CHECK_STATUS(tctx, status, NT_STATUS_OK); torture_wait_for_oplock_break(tctx); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); CHECK_VAL(break_info.level, 0); @@ -1615,7 +1623,7 @@ static bool test_raw_oplock_batch12(struct torture_context *tctx, struct smbcli_ CHECK_STATUS(tctx, status, NT_STATUS_OK); torture_wait_for_oplock_break(tctx); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); CHECK_VAL(break_info.level, 0); @@ -1692,7 +1700,7 @@ static bool test_raw_oplock_batch13(struct torture_context *tctx, struct smbcli_ fnum2 = io.ntcreatex.out.file.fnum; torture_wait_for_oplock_break(tctx); CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); smbcli_close(cli1->tree, fnum); @@ -1769,7 +1777,7 @@ static bool test_raw_oplock_batch14(struct torture_context *tctx, struct smbcli_ CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN); torture_wait_for_oplock_break(tctx); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); smbcli_close(cli1->tree, fnum); @@ -1921,7 +1929,7 @@ static bool test_raw_oplock_batch16(struct torture_context *tctx, struct smbcli_ CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN); torture_wait_for_oplock_break(tctx); - CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx)); CHECK_VAL(break_info.failures, 0); smbcli_close(cli1->tree, fnum); @@ -2619,15 +2627,11 @@ static bool test_raw_oplock_batch22(struct torture_context *tctx, struct smbcli_ NTSTATUS status; bool ret = true; union smb_open io; - uint16_t fnum=0, fnum2=0; + uint16_t fnum = 0, fnum2 = 0, fnum3 = 0; struct timeval tv; int timeout = torture_setting_int(tctx, "oplocktimeout", 30); int te; - if (torture_setting_bool(tctx, "samba3", false)) { - torture_skip(tctx, "BATCH22 disabled against samba3\n"); - } - if (!torture_setup_dir(cli1, BASEDIR)) { return false; } @@ -2636,7 +2640,6 @@ static bool test_raw_oplock_batch22(struct torture_context *tctx, struct smbcli_ smbcli_unlink(cli1->tree, fname); smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree); - /* base ntcreatex parms */ @@ -2673,9 +2676,25 @@ static bool test_raw_oplock_batch22(struct torture_context *tctx, struct smbcli_ tv = timeval_current(); smbcli_oplock_handler(cli1->transport, oplock_handler_timeout, cli1->tree); status = smb_raw_open(cli1->tree, tctx, &io); - CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION); + + if (TARGET_IS_W2K3(tctx)) { + /* 2k3 has an issue here. xp/win7 are ok. */ + CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION); + } else { + CHECK_STATUS(tctx, status, NT_STATUS_OK); + } + + fnum2 = io.ntcreatex.out.file.fnum; + torture_wait_for_oplock_break(tctx); te = (int)timeval_elapsed(&tv); + + /* + * Some servers detect clients that let oplocks timeout, so this check + * only shows a warning message instead failing the test to eliminate + * failures from repeated runs of the test. This isn't ideal, but + * it's better than not running the test at all. + */ CHECK_RANGE(te, timeout - 1, timeout + 15); CHECK_VAL(break_info.count, 1); @@ -2690,17 +2709,24 @@ static bool test_raw_oplock_batch22(struct torture_context *tctx, struct smbcli_ smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree); status = smb_raw_open(cli1->tree, tctx, &io); CHECK_STATUS(tctx, status, NT_STATUS_OK); - CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN); + if (TARGET_IS_SAMBA3(tctx)) { + /* samba3 doesn't grant additional oplocks to bad clients. */ + CHECK_VAL(io.ntcreatex.out.oplock_level, NO_OPLOCK_RETURN); + } else { + CHECK_VAL(io.ntcreatex.out.oplock_level, + LEVEL_II_OPLOCK_RETURN); + } torture_wait_for_oplock_break(tctx); te = (int)timeval_elapsed(&tv); /* it should come in without delay */ CHECK_RANGE(te+1, 0, timeout); - fnum2 = io.ntcreatex.out.file.fnum; + fnum3 = io.ntcreatex.out.file.fnum; CHECK_VAL(break_info.count, 0); smbcli_close(cli1->tree, fnum); smbcli_close(cli1->tree, fnum2); + smbcli_close(cli1->tree, fnum3); done: smb_raw_exit(cli1->session); @@ -2943,6 +2969,113 @@ done: return ret; } +/** + * Similar to batch17/18, but test with open share mode rather than + * share_none. + */ +static bool test_raw_oplock_batch26(struct torture_context *tctx, + struct smbcli_state *cli1, struct smbcli_state *cli2) +{ + const char *fname1 = BASEDIR "\\test_batch26_1.dat"; + const char *fname2 = BASEDIR "\\test_batch26_2.dat"; + NTSTATUS status; + bool ret = true; + union smb_open io; + union smb_rename rn; + uint16_t fnum=0; + + if (!torture_setup_dir(cli1, BASEDIR)) { + return false; + } + + /* cleanup */ + smbcli_unlink(cli1->tree, fname1); + smbcli_unlink(cli1->tree, fname2); + + smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, + cli1->tree); + + /* + base ntcreatex parms + */ + io.generic.level = RAW_OPEN_NTCREATEX; + io.ntcreatex.in.root_fid.fnum = 0; + io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; + io.ntcreatex.in.alloc_size = 0; + io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; + io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | + NTCREATEX_SHARE_ACCESS_WRITE | NTCREATEX_SHARE_ACCESS_DELETE; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF; + io.ntcreatex.in.create_options = 0; + io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; + io.ntcreatex.in.security_flags = 0; + io.ntcreatex.in.fname = fname1; + + torture_comment(tctx, "BATCH26: open a file with an batch oplock " + "(share mode: none)\n"); + + ZERO_STRUCT(break_info); + io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED | + NTCREATEX_FLAGS_REQUEST_OPLOCK | + NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK; + + + status = smb_raw_open(cli1->tree, tctx, &io); + CHECK_STATUS(tctx, status, NT_STATUS_OK); + fnum = io.ntcreatex.out.file.fnum; + CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN); + + torture_comment(tctx, "rename should trigger a break\n"); + ZERO_STRUCT(rn); + rn.generic.level = RAW_RENAME_RENAME; + rn.rename.in.pattern1 = fname1; + rn.rename.in.pattern2 = fname2; + rn.rename.in.attrib = 0; + + torture_comment(tctx, "trying rename while first file open\n"); + status = smb_raw_rename(cli2->tree, &rn); + CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION); + + torture_wait_for_oplock_break(tctx); + CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.failures, 0); + CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_LEVEL_II); + + /* Close and reopen with batch again. */ + smbcli_close(cli1->tree, fnum); + ZERO_STRUCT(break_info); + + status = smb_raw_open(cli1->tree, tctx, &io); + CHECK_STATUS(tctx, status, NT_STATUS_OK); + fnum = io.ntcreatex.out.file.fnum; + CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN); + + /* Now try ntrename. */ + torture_comment(tctx, "ntrename should trigger a break\n"); + ZERO_STRUCT(rn); + rn.generic.level = RAW_RENAME_NTRENAME; + rn.ntrename.in.attrib = 0; + rn.ntrename.in.flags = RENAME_FLAG_RENAME; + rn.ntrename.in.old_name = fname1; + rn.ntrename.in.new_name = fname2; + torture_comment(tctx, "trying rename while first file open\n"); + status = smb_raw_rename(cli2->tree, &rn); + CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION); + + torture_wait_for_oplock_break(tctx); + CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.failures, 0); + CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_LEVEL_II); + + smbcli_close(cli1->tree, fnum); + +done: + smb_raw_exit(cli1->session); + smb_raw_exit(cli2->session); + smbcli_deltree(cli1->tree, BASEDIR); + return ret; +} + /* Test how oplocks work on streams. */ static bool test_raw_oplock_stream1(struct torture_context *tctx, struct smbcli_state *cli1, @@ -3531,6 +3664,7 @@ struct torture_suite *torture_raw_oplock(TALLOC_CTX *mem_ctx) torture_suite_add_2smb_test(suite, "BATCH23", test_raw_oplock_batch23); torture_suite_add_2smb_test(suite, "BATCH24", test_raw_oplock_batch24); torture_suite_add_2smb_test(suite, "BATCH25", test_raw_oplock_batch25); + torture_suite_add_2smb_test(suite, "BATCH26", test_raw_oplock_batch26); torture_suite_add_2smb_test(suite, "STREAM1", test_raw_oplock_stream1); torture_suite_add_1smb_test(suite, "DOC1", test_raw_oplock_doc); torture_suite_add_2smb_test(suite, "BRL1", test_raw_oplock_brl1); diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index cdf68bd..8742a8c 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -525,6 +525,10 @@ int main(int argc,char *argv[]) lp_set_cmdline(cmdline_lp_ctx, "torture:samba3", "true"); } else if (strcmp(target, "samba4") == 0) { lp_set_cmdline(cmdline_lp_ctx, "torture:samba4", "true"); + } else if (strcmp(target, "winxp") == 0) { + lp_set_cmdline(cmdline_lp_ctx, "torture:winxp", "true"); + } else if (strcmp(target, "w2k3") == 0) { + lp_set_cmdline(cmdline_lp_ctx, "torture:w2k3", "true"); } else if (strcmp(target, "w2k8") == 0) { lp_set_cmdline(cmdline_lp_ctx, "torture:w2k8", "true"); lp_set_cmdline(cmdline_lp_ctx, @@ -540,6 +544,8 @@ int main(int argc,char *argv[]) lp_set_cmdline(cmdline_lp_ctx, "torture:sacl_support", "false"); lp_set_cmdline(cmdline_lp_ctx, "torture:smblock_pdu_support", "false"); + lp_set_cmdline(cmdline_lp_ctx, "torture:2_step_break_to_none", + "true"); } if (max_runtime) { diff --git a/source4/torture/smbtorture.h b/source4/torture/smbtorture.h index 9767804..c7bbcf2 100644 --- a/source4/torture/smbtorture.h +++ b/source4/torture/smbtorture.h @@ -85,4 +85,10 @@ bool torture_register_suite(struct torture_suite *suite); * * This parameter specifies whether the server supports the SMBLock (0x0C) PDU. */ +/* torture:2_step_break_to_none + * + * If true this parameter tests servers that break from level 1 to none in two + * steps rather than 1. + */ + #endif /* __SMBTORTURE_H__ */ diff --git a/source4/torture/util.h b/source4/torture/util.h index 3566241..0dadc89 100644 --- a/source4/torture/util.h +++ b/source4/torture/util.h @@ -28,6 +28,8 @@ struct smbcli_tree; /** * Useful target macros for handling server bugs in torture tests. */ +#define TARGET_IS_WINXP(_tctx) (torture_setting_bool(_tctx, "winxp", false)) +#define TARGET_IS_W2K3(_tctx) (torture_setting_bool(_tctx, "w2k3", false)) #define TARGET_IS_W2K8(_tctx) (torture_setting_bool(_tctx, "w2k8", false)) #define TARGET_IS_WIN7(_tctx) (torture_setting_bool(_tctx, "win7", false)) #define TARGET_IS_SAMBA3(_tctx) (torture_setting_bool(_tctx, "samba3", false)) -- Samba Shared Repository