]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: only store durable handles with byte range locks when having WRITE lease
authorStefan Metzmacher <metze@samba.org>
Fri, 30 Aug 2024 16:10:16 +0000 (18:10 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 10 Oct 2024 12:47:33 +0000 (12:47 +0000)
This simplifies the reconnect assumptions, when we want to allow
more than one durable handle on a file for multiple clients with
READ+HANDLE leases.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15649
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15651

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
selftest/knownfail.d/smb2.durable.lock [deleted file]
source3/smbd/durable.c

diff --git a/selftest/knownfail.d/smb2.durable.lock b/selftest/knownfail.d/smb2.durable.lock
deleted file mode 100644 (file)
index 16273fb..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-^samba3.smb2.durable-open.lock-noW-lease
-^samba3.smb2.durable-v2-open.lock-noW-lease
index dfb87dd3775cdfee71d02b2766df24895a2a84fb..2325e69cccc60822eb43855b30654175e006a786 100644 (file)
@@ -173,6 +173,12 @@ NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp,
                return NT_STATUS_NOT_SUPPORTED;
        }
 
+       if (fsp->current_lock_count != 0 &&
+           (fsp_lease_type(fsp) & SMB2_LEASE_WRITE) == 0)
+       {
+               return NT_STATUS_NOT_SUPPORTED;
+       }
+
        /*
         * For now let it be simple and do not keep
         * delete on close files durable open