]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbtorture: correctly handle scale-out shares in smb2.durable-v2-open.create-blob
authorRalph Boehme <slow@samba.org>
Fri, 28 Feb 2025 05:15:26 +0000 (06:15 +0100)
committerVolker Lendecke <vl@samba.org>
Fri, 10 Oct 2025 15:59:35 +0000 (15:59 +0000)
On a share with SMB2_SHARE_CAP_SCALEOUT capability the cluster doesn't
grant batch oplocks, at most level-II oplocks and it also doesn't
grant durable-handles (v1 or v2) as they require an RWH-lease.

With this change the test passes against Windows Server 2025.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source4/torture/smb2/durable_v2_open.c

index 207e0d612a82dac7a2a4057ec287c06d8122dbf0..ed0b32237b15dd2cb55f3167b613870b94ca746d 100644 (file)
@@ -112,6 +112,24 @@ bool test_durable_v2_open_create_blob(struct torture_context *tctx,
        struct GUID create_guid = GUID_random();
        bool ret = true;
        struct smbcli_options options;
+       uint32_t share_capabilities;
+       bool share_is_so;
+       uint8_t expected_oplock_granted;
+       bool expected_dhv2_granted;
+       uint32_t expected_dhv2_timeout;
+
+       share_capabilities = smb2cli_tcon_capabilities(tree->smbXcli);
+       share_is_so = share_capabilities & SMB2_SHARE_CAP_SCALEOUT;
+
+       if (share_is_so) {
+               expected_oplock_granted = SMB2_OPLOCK_LEVEL_II;
+               expected_dhv2_granted = false;
+               expected_dhv2_timeout = 0;
+       } else {
+               expected_oplock_granted = SMB2_OPLOCK_LEVEL_BATCH;
+               expected_dhv2_granted = true;
+               expected_dhv2_timeout = 300*1000;
+}
 
        options = tree->session->transport->options;
 
@@ -135,11 +153,11 @@ bool test_durable_v2_open_create_blob(struct torture_context *tctx,
        _h = io.out.file.handle;
        h = &_h;
        CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
-       CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b"));
+       CHECK_VAL(io.out.oplock_level, expected_oplock_granted);
        CHECK_VAL(io.out.durable_open, false);
-       CHECK_VAL(io.out.durable_open_v2, true);
+       CHECK_VAL(io.out.durable_open_v2, expected_dhv2_granted);
        CHECK_VAL(io.out.persistent_open, false);
-       CHECK_VAL(io.out.timeout, 300*1000);
+       CHECK_VAL(io.out.timeout, expected_dhv2_timeout);
 
        /* disconnect */
        TALLOC_FREE(tree);