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 <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Aug 15 16:51:05 UTC 2025 on atb-devel-224
+++ /dev/null
-^samba3.smb2.lease.sharing_violation\(fileserver\)
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);
}
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