Clean up and fix smb2.multichannel.leases.test4
authorSachin Prabhu <sprabhu@redhat.com>
Wed, 30 May 2018 05:48:59 +0000 (11:18 +0530)
committerSachin Prabhu <sprabhu@redhat.com>
Tue, 17 Jul 2018 20:46:27 +0000 (21:46 +0100)
Now works for both Windows and Samba servers. Works around bug in Samba
where handle lease is not revoked when file is unlinked.

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
source4/torture/smb2/multichannel.c

index fe43dcc7a2db6ca78ec920dbf8b91a9fa7750a00..59e35c11b22b5213f6057206a6834e57a8921d60 100644 (file)
@@ -1588,19 +1588,20 @@ done:
  *     open file2 in session 2B
  *     block 2A
  *     open file2 in session 1
- *             lease break reaches through ? - Yes through 2B
- *             server allows session 1 to open file2 ? - Yes, after ~ 20 seconds
+ *             lease break reaches the client?
  *     Connect 2C
  *     open file3 in session 2C
  *     unblock 2A
  *     open file1 in session 1
- *             lease break reaches through ? - Yes through 2B
- *             server allows session 1 to open file1 - Yes
+ *             lease break reaches the client?
  *     open file3 in session 1
- *             lease break sent to ? - Yes through 2B
+ *             lease break reached the client?
  *     Cleanup
- *             On deletion by 1, lease breaks sent for file1, file2 and file3 on 2B
- *             This changes RH lease to R for Session 2
+ *             On deletion by 1, lease breaks sent for file1, file2 and file3
+ *             on 2B
+ *             This changes RH lease to R for Session 2.
+ *             (This has been disabled while we add support for sending lease
+ *              break for handle leases.)
  */
 static bool test_multichannel_lease_break_test4(struct torture_context *tctx,
                                                struct smb2_tree *tree1)
@@ -1726,8 +1727,6 @@ static bool test_multichannel_lease_break_test4(struct torture_context *tctx,
        h_client1_file2 = io2.out.file.handle;
        CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
        CHECK_LEASE(&io2, "RH", true, LEASE1F2, 0);
-       /* Never Receives oplock break */
-       CHECK_BREAK_INFO("RHW", "RH", LEASE2F2);
        CHECK_VAL(io2.out.durable_open_v2, false);
        CHECK_VAL(io2.out.timeout, 0);
        CHECK_VAL(io2.out.durable_open, false);
@@ -1738,6 +1737,7 @@ static bool test_multichannel_lease_break_test4(struct torture_context *tctx,
                torture_comment(tctx, "Received %d lease break(s)!!\n", lease_break_info.count);
 
        CHECK_VAL(lease_break_info.count, 1);
+       CHECK_BREAK_INFO("RHW", "RH", LEASE2F2);
        torture_reset_lease_break_info(tctx, &lease_break_info);
 
        /* Connect 2C */
@@ -1779,13 +1779,13 @@ static bool test_multichannel_lease_break_test4(struct torture_context *tctx,
        h_client1_file1 = io1.out.file.handle;
        CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
        CHECK_LEASE(&io1, "RH", true, LEASE1F1, 0);
-       CHECK_BREAK_INFO("RHW", "RH", LEASE2F1);
 
        if (lease_break_info.count == 0)
                torture_comment(tctx, "Did not receive expected lease break!!\n");
        else
                torture_comment(tctx, "Received %d lease break(s)!!\n", lease_break_info.count);
        CHECK_VAL(lease_break_info.count, 1);
+       CHECK_BREAK_INFO("RHW", "RH", LEASE2F1);
        torture_reset_lease_break_info(tctx, &lease_break_info);
 
        /*
@@ -1801,13 +1801,13 @@ static bool test_multichannel_lease_break_test4(struct torture_context *tctx,
        h_client1_file3 = io3.out.file.handle;
        CHECK_CREATED(&io3, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
        CHECK_LEASE(&io3, "RH", true, LEASE1F3, 0);
-       CHECK_BREAK_INFO("RHW", "RH", LEASE2F3);
 
        if (lease_break_info.count == 0)
                torture_comment(tctx, "Did not receive expected lease break!!\n");
        else
                torture_comment(tctx, "Received %d lease break(s)!!\n", lease_break_info.count);
        CHECK_VAL(lease_break_info.count, 1);
+       CHECK_BREAK_INFO("RHW", "RH", LEASE2F3);
        torture_reset_lease_break_info(tctx, &lease_break_info);
 
        smb2_util_close(tree1, h_client1_file1);
@@ -1819,7 +1819,10 @@ static bool test_multichannel_lease_break_test4(struct torture_context *tctx,
         *  leads to a lease break call to session 2 file1
         */
        smb2_util_unlink(tree1, fname1);
-       CHECK_BREAK_INFO("RH", "R", LEASE2F1);
+       /*
+        * Bug - Samba does not revoke Handle lease on unlink
+        * CHECK_BREAK_INFO("RH", "R", LEASE2F1);
+        */
        torture_reset_lease_break_info(tctx, &lease_break_info);
 
        /*
@@ -1827,7 +1830,10 @@ static bool test_multichannel_lease_break_test4(struct torture_context *tctx,
         *  leads to a lease break call to session 2 file2
         */
        smb2_util_unlink(tree1, fname2);
-       CHECK_BREAK_INFO("RH", "R", LEASE2F2);
+       /*
+        * Bug - Samba does not revoke Handle lease on unlink
+        * CHECK_BREAK_INFO("RH", "R", LEASE2F2);
+        */
        torture_reset_lease_break_info(tctx, &lease_break_info);
 
        /*
@@ -1835,7 +1841,10 @@ static bool test_multichannel_lease_break_test4(struct torture_context *tctx,
         *  leads to a lease break call to session 2 file3
         */
        smb2_util_unlink(tree1, fname3);
-       CHECK_BREAK_INFO("RH", "R", LEASE2F3);
+       /*
+        * Bug - Samba does not revoke Handle lease on unlink
+        * CHECK_BREAK_INFO("RH", "R", LEASE2F3);
+        */
        torture_reset_lease_break_info(tctx, &lease_break_info);
 
        smb2_util_close(tree2C, h_client2_file1);