From: Ralph Boehme Date: Fri, 8 Aug 2025 11:52:59 +0000 (+0200) Subject: smbd: improve lease break when handling overwrite create disposition X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=65d86082338c0b46358520ba5134b3f9c39291ee;p=thirdparty%2Fsamba.git smbd: improve lease break when handling overwrite create disposition If the contending create uses overwrite create disposition, but has caused a sharing violation and the existing create has a SMB2_LEASE_HANDLE, then the server should just send break the SMB2_LEASE_HANDLE. The break will then either result in a close and the contending open succeeds, or a STATUS_SHARING_VIOLATION. Either way, there's no need to additionally break SMB2_LEASE_READ or SMB2_LEASE_WRITE. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15894 Signed-off-by: Ralph Boehme Reviewed-by: Volker Lendecke Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Fri Aug 15 16:51:05 UTC 2025 on atb-devel-224 --- diff --git a/selftest/knownfail.d/samba3.smb2.lease b/selftest/knownfail.d/samba3.smb2.lease deleted file mode 100644 index b9c36e50daa..00000000000 --- a/selftest/knownfail.d/samba3.smb2.lease +++ /dev/null @@ -1 +0,0 @@ -^samba3.smb2.lease.sharing_violation\(fileserver\) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 01c06f69c9d..e898829c52c 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2269,7 +2269,7 @@ static bool delay_for_oplock_fn( break_to = e_lease_type & ~state->delay_mask; - if (state->will_overwrite) { + if (state->will_overwrite && !(state->delay_mask & SMB2_LEASE_HANDLE)) { break_to &= ~(SMB2_LEASE_HANDLE|SMB2_LEASE_READ); } @@ -2288,7 +2288,7 @@ static bool delay_for_oplock_fn( return false; } - if (state->will_overwrite) { + if (state->will_overwrite && !(state->delay_mask & SMB2_LEASE_HANDLE)) { /* * If we break anyway break to NONE directly. * Otherwise vfs_set_filelen() will trigger the