torture: Extend the raw.oplock.doc1 test
authorVolker Lendecke <vl@samba.org>
Thu, 26 Sep 2013 02:00:57 +0000 (19:00 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 11 Oct 2013 22:07:34 +0000 (15:07 -0700)
If delete_on_close is set, there is no oplock break. Check that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
selftest/knownfail
source4/torture/raw/oplock.c

index 8b89f00f60b22e6fb7641ac3ecaaf70635f4fe08..e349c63e133923c5c96774aea2c0ec4669295575 100644 (file)
 ^samba4.smb2.lock.*.multiple-unlock # bug 6959
 ^samba4.raw.sfileinfo.*.end-of-file\(.*\)$ # bug 6962
 ^samba4.raw.oplock.*.batch22 # bug 6963
+^samba4.raw.oplock.*.doc1
 ^samba4.raw.lock.*.zerobyteread # bug 6974
 ^samba4.smb2.lock.*.zerobyteread # bug 6974
 ^samba4.raw.streams.*.delete
index c2e086aa95af5942078c841667e1511d8c8dc474..b4aac1154b77afc5f2fcab064834cf1fdec80b93 100644 (file)
@@ -3576,7 +3576,8 @@ static bool test_raw_oplock_stream1(struct torture_context *tctx,
 }
 
 static bool test_raw_oplock_doc(struct torture_context *tctx,
-                               struct smbcli_state *cli)
+                               struct smbcli_state *cli,
+                               struct smbcli_state *cli2)
 {
        const char *fname = BASEDIR "\\test_oplock_doc.dat";
        NTSTATUS status;
@@ -3600,16 +3601,15 @@ static bool test_raw_oplock_doc(struct torture_context *tctx,
        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_NONE;
+       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 = NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
+       io.ntcreatex.in.create_options = 0;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
        io.ntcreatex.in.fname = fname;
 
-       torture_comment(tctx, "open a delete-on-close file with a batch "
-                       "oplock\n");
-       ZERO_STRUCT(break_info);
+       torture_comment(tctx, "open a file with a batch oplock\n");
        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
            NTCREATEX_FLAGS_REQUEST_OPLOCK |
            NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
@@ -3619,6 +3619,20 @@ static bool test_raw_oplock_doc(struct torture_context *tctx,
        fnum = io.ntcreatex.out.file.fnum;
        CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN);
 
+       torture_comment(tctx, "Set delete-on-close\n");
+       status = smbcli_nt_delete_on_close(cli->tree, fnum, true);
+       CHECK_STATUS(tctx, status, NT_STATUS_OK);
+
+       torture_comment(tctx, "2nd open should not break and get "
+                       "DELETE_PENDING\n");
+       ZERO_STRUCT(break_info);
+       io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
+       io.ntcreatex.in.create_options = 0;
+       io.ntcreatex.in.access_mask = SEC_FILE_READ_DATA;
+       status = smb_raw_open(cli2->tree, tctx, &io);
+       CHECK_STATUS(tctx, status, NT_STATUS_DELETE_PENDING);
+       CHECK_VAL(break_info.count, 0);
+
        smbcli_close(cli->tree, fnum);
 
 done:
@@ -4075,7 +4089,7 @@ struct torture_suite *torture_raw_oplock(TALLOC_CTX *mem_ctx)
        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, "doc1", test_raw_oplock_doc);
        torture_suite_add_2smb_test(suite, "brl1", test_raw_oplock_brl1);
        torture_suite_add_1smb_test(suite, "brl2", test_raw_oplock_brl2);
        torture_suite_add_1smb_test(suite, "brl3", test_raw_oplock_brl3);