]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
torture: Run durable_v2_reconnect_delay_msec with leases
authorVolker Lendecke <vl@samba.org>
Tue, 10 Dec 2019 10:48:07 +0000 (11:48 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 10 Dec 2019 20:31:40 +0000 (20:31 +0000)
This will show a leases.tdb record leak. If you SIGSTOP the smbtorture
process while it's in the 10-second wait, you will find locking.tdb
and share_entries.tdb empty after the scavenger has cleaned up. But
there will be an entry in leases.tdb left.

I have no clue how to test this properly, or how to have a reasonably
cheap assert in smbd during normal operations. The problem is that
this leak can't really be distinguished from a "normal" leak that a
crashed smbd would leave behind. Possibly we need a background job
walking leases.tdb to clean this up properly.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
selftest/knownfail.d/durable-v2-delay [new file with mode: 0644]
source4/torture/smb2/durable_v2_open.c

diff --git a/selftest/knownfail.d/durable-v2-delay b/selftest/knownfail.d/durable-v2-delay
new file mode 100644 (file)
index 0000000..2a84749
--- /dev/null
@@ -0,0 +1,2 @@
+# In the ad_dc env leases are disabled
+^samba3.smb2.durable-v2-delay.durable_v2_reconnect_delay_msec\(ad_dc\)
index 0f76abd7c5bf10e52847e625a41c71646fe690b7..b2c519db3f67a46aba5bf82dbd71f72b54b27752 100644 (file)
@@ -2135,6 +2135,7 @@ static bool test_durable_v2_reconnect_delay_msec(
        struct smb2_handle _h;
        struct smb2_handle *h = NULL;
        struct smb2_create io;
+       struct smb2_lease ls;
        struct GUID create_guid = GUID_random();
        struct smbcli_options options;
        uint64_t previous_session_id;
@@ -2152,9 +2153,13 @@ static bool test_durable_v2_reconnect_delay_msec(
 
        smb2_util_unlink(tree, fname);
 
-       smb2_oplock_create_share(&io, fname,
-                                smb2_util_share_access(""),
-                                smb2_util_oplock_level("b"));
+       smb2_lease_create(
+               &io,
+               &ls,
+               false /* dir */,
+               fname,
+               generate_random_u64(),
+               smb2_util_lease_state("RWH"));
        io.in.durable_open = false;
        io.in.durable_open_v2 = true;
        io.in.persistent_open = false;
@@ -2166,7 +2171,7 @@ static bool test_durable_v2_reconnect_delay_msec(
 
        _h = io.out.file.handle;
        h = &_h;
-       CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b"));
+       CHECK_VAL(io.out.oplock_level, SMB2_OPLOCK_LEVEL_LEASE);
        CHECK_VAL(io.out.durable_open_v2, true);
 
        status = smb2_util_write(tree, *h, &b, 0, 1);