Revert "HACKS *.oplock.batch9 ... this is very strange with stat opens and different...
authorStefan Metzmacher <metze@samba.org>
Fri, 7 Nov 2014 15:18:56 +0000 (16:18 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 28 Jan 2020 12:26:51 +0000 (13:26 +0100)
This reverts commit 1e1d85f59ffb6120911ca496b787870ba36c4532.

source4/torture/raw/oplock.c
source4/torture/smb2/oplock.c

index c0e48da3dbc5acc12007daff4c45db6ec0927e3f..4061d409cf293f5576b8be6d558ec226549cbdf2 100644 (file)
@@ -1807,11 +1807,10 @@ static bool test_raw_oplock_batch9(struct torture_context *tctx, struct smbcli_s
                NTCREATEX_FLAGS_REQUEST_OPLOCK | 
                NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
        io.ntcreatex.in.access_mask = SEC_FILE_READ_ATTRIBUTE|SEC_FILE_WRITE_ATTRIBUTE|SEC_STD_SYNCHRONIZE;
-       io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OVERWRITE_IF;
+       io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
        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.create_action, FILE_WAS_CREATED);
        CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN);
 
        torture_comment(tctx, "Subsequent normal open should break oplock on attribute only open to level II\n");
@@ -1822,17 +1821,16 @@ static bool test_raw_oplock_batch9(struct torture_context *tctx, struct smbcli_s
        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED | 
                NTCREATEX_FLAGS_REQUEST_OPLOCK | 
                NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
-       //io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
+       io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        status = smb_raw_open(cli2->tree, tctx, &io);
        CHECK_STATUS(tctx, status, NT_STATUS_OK);
        fnum2 = io.ntcreatex.out.file.fnum;
        torture_wait_for_oplock_break(tctx);
-       //CHECK_VAL(break_info.count, 1);
-       //CHECK_VAL(break_info.fnum, fnum);
-       //CHECK_VAL(break_info.failures, 0);
-       //CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_LEVEL_II);
-       CHECK_VAL(io.ntcreatex.out.create_action, FILE_WAS_OPENED);
+       CHECK_VAL(break_info.count, 1);
+       CHECK_VAL(break_info.fnum, fnum);
+       CHECK_VAL(break_info.failures, 0);
+       CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_LEVEL_II);
        CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
        smbcli_close(cli2->tree, fnum2);
 
@@ -1843,7 +1841,7 @@ static bool test_raw_oplock_batch9(struct torture_context *tctx, struct smbcli_s
        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED | 
                NTCREATEX_FLAGS_REQUEST_OPLOCK | 
                NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
-       //io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
+       io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        status = smb_raw_open(cli2->tree, tctx, &io);
        CHECK_STATUS(tctx, status, NT_STATUS_OK);
@@ -1851,7 +1849,6 @@ static bool test_raw_oplock_batch9(struct torture_context *tctx, struct smbcli_s
        torture_wait_for_oplock_break(tctx);
        CHECK_VAL(break_info.count, 0);
        CHECK_VAL(break_info.failures, 0);
-       CHECK_VAL(io.ntcreatex.out.create_action, FILE_WAS_OPENED);
        CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
 
        ZERO_STRUCT(break_info);
index b9b99b15bc5ccb6a53559e723dbb693ed5eee593..d39b904cc7cddfa30b642bf08eb2c38155db1206 100644 (file)
@@ -1492,7 +1492,6 @@ static bool test_smb2_oplock_batch9(struct torture_context *tctx,
                                SEC_STD_SYNCHRONIZE;
        io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
        io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
-       io.smb2.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
        status = smb2_create(tree1, tctx, &(io.smb2));
        torture_assert_ntstatus_ok(tctx, status, "Error opening the file");
        h1 = io.smb2.out.file.handle;
@@ -1506,22 +1505,18 @@ static bool test_smb2_oplock_batch9(struct torture_context *tctx,
 
        io.smb2.in.create_flags = NTCREATEX_FLAGS_EXTENDED;
        io.smb2.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH;
-       //io.smb2.in.desired_access = SEC_RIGHTS_FILE_ALL;
+       io.smb2.in.desired_access = SEC_RIGHTS_FILE_ALL;
        io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
        io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
-       io.smb2.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
        status = smb2_create(tree2, tctx, &(io.smb2));
        torture_assert_ntstatus_ok(tctx, status, "Incorrect status");
        h2 = io.smb2.out.file.handle;
        torture_wait_for_oplock_break(tctx);
-       //CHECK_VAL(break_info.count, 1);
-       //CHECK_VAL(break_info.handle.data[0], h1.data[0]);
-       //CHECK_VAL(break_info.failures, 0);
-       //CHECK_VAL(break_info.level, SMB2_OPLOCK_LEVEL_II);
-       //CHECK_VAL(break_info.level, SMB2_OPLOCK_LEVEL_NONE);
-       //CHECK_VAL(io.smb2.out.create_action, FILE_WAS_OPENED);
-       //CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
-       CHECK_VAL(io.smb2.out.create_action, FILE_WAS_OVERWRITTEN);
+       CHECK_VAL(break_info.count, 1);
+       CHECK_VAL(break_info.handle.data[0], h1.data[0]);
+       CHECK_VAL(break_info.failures, 0);
+       CHECK_VAL(break_info.level, SMB2_OPLOCK_LEVEL_II);
+       CHECK_VAL(io.smb2.out.create_action, FILE_WAS_OPENED);
        CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_II);
        smb2_util_close(tree2, h2);
 
@@ -1534,7 +1529,7 @@ static bool test_smb2_oplock_batch9(struct torture_context *tctx,
 
        io.smb2.in.create_flags = NTCREATEX_FLAGS_EXTENDED;
        io.smb2.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH;
-       //io.smb2.in.desired_access = SEC_RIGHTS_FILE_ALL;
+       io.smb2.in.desired_access = SEC_RIGHTS_FILE_ALL;
        io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
        status = smb2_create(tree2, tctx, &(io.smb2));
        torture_assert_ntstatus_ok(tctx, status, "Incorrect status");
@@ -1542,42 +1537,10 @@ static bool test_smb2_oplock_batch9(struct torture_context *tctx,
        torture_wait_for_oplock_break(tctx);
        CHECK_VAL(break_info.count, 0);
        CHECK_VAL(break_info.failures, 0);
-       CHECK_VAL(io.smb2.out.create_action, FILE_WAS_OPENED);
        CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_II);
-       //CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
 
-       io.smb2.in.create_flags = NTCREATEX_FLAGS_EXTENDED;
-       io.smb2.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH;
-       //io.smb2.in.desired_access = SEC_RIGHTS_FILE_ALL;
-       io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
-       status = smb2_create(tree2, tctx, &(io.smb2));
-       torture_assert_ntstatus_ok(tctx, status, "Incorrect status");
-       //h2 = io.smb2.out.file.handle;
-       torture_wait_for_oplock_break(tctx);
-       CHECK_VAL(break_info.count, 0);
-       CHECK_VAL(break_info.failures, 0);
-       CHECK_VAL(io.smb2.out.create_action, FILE_WAS_OPENED);
-       CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_II);
-       //CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
        ZERO_STRUCT(break_info);
 
-       smb2_util_close(tree1, h1);
-       smb2_util_close(tree2, h2);
-       h2 = io.smb2.out.file.handle;
-       smb2_util_close(tree2, h2);
-       io.smb2.in.create_flags = NTCREATEX_FLAGS_EXTENDED;
-       io.smb2.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH;
-       //io.smb2.in.desired_access = SEC_RIGHTS_FILE_ALL;
-       io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
-       status = smb2_create(tree2, tctx, &(io.smb2));
-       torture_assert_ntstatus_ok(tctx, status, "Incorrect status");
-       h2 = io.smb2.out.file.handle;
-       torture_wait_for_oplock_break(tctx);
-       CHECK_VAL(break_info.count, 0);
-       CHECK_VAL(break_info.failures, 0);
-       CHECK_VAL(io.smb2.out.create_action, FILE_WAS_OPENED);
-       CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH);
-       //CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
        torture_comment(tctx, "write should trigger a break to none on both\n");
        tree1->session->transport->oplock.handler =
            torture_oplock_handler_level2_to_none;
@@ -1589,7 +1552,7 @@ static bool test_smb2_oplock_batch9(struct torture_context *tctx,
        torture_wait_for_oplock_break(tctx);
        torture_wait_for_oplock_break(tctx);
 
-       //CHECK_VAL(break_info.count, 2);
+       CHECK_VAL(break_info.count, 2);
        CHECK_VAL(break_info.level, 0);
        CHECK_VAL(break_info.failures, 0);