^samba3.smb2.compound.interim2 # wrong return code (STATUS_CANCELLED)
^samba3.smb2.compound.aio.interim2 # wrong return code (STATUS_CANCELLED)
^samba3.smb2.lock.*replay_broken_windows # This tests the windows behaviour
-^samba3.smb2.lease.statopen3
^samba3.smb2.lease.unlink # we currently do not downgrade RH lease to R after unlink
^samba4.smb2.ioctl.compress_notsup.*\(ad_dc_ntvfs\)
^samba3.raw.session.*reauth2 # maybe fix this?
bool first_open_attempt;
bool got_handle_lease;
bool got_oplock;
- bool have_other_lease;
+ bool disallow_write_lease;
uint32_t total_lease_types;
bool delay;
struct blocker_debug_state *blocker_debug_state;
}
if (!state->got_oplock &&
+ (e->op_type != NO_OPLOCK) &&
(e->op_type != LEASE_OPLOCK) &&
!share_entry_stale_pid(e)) {
state->got_oplock = true;
}
- if (!state->have_other_lease &&
+ /*
+ * Two things prevent a write lease
+ * to be granted:
+ *
+ * 1. Any oplock or lease (even broken to NONE)
+ * 2. An open with an access mask other than
+ * FILE_READ_ATTRIBUTES, FILE_WRITE_ATTRIBUTES
+ * or SYNCHRONIZE_ACCESS
+ */
+ if (!state->disallow_write_lease &&
+ (e->op_type != NO_OPLOCK || !is_oplock_stat_open(e->access_mask)) &&
!is_same_lease(fsp, e, lease) &&
- !share_entry_stale_pid(e)) {
- state->have_other_lease = true;
+ !share_entry_stale_pid(e))
+ {
+ state->disallow_write_lease = true;
}
if (e_is_lease && is_lease_stat_open(fsp->access_mask)) {
granted &= ~SMB2_LEASE_READ;
}
- if (state.have_other_lease) {
+ if (state.disallow_write_lease) {
/*
- * Can grant only one writer
+ * Can grant only a write lease
+ * if there are no other leases
+ * and no other non-stat opens.
*/
granted &= ~SMB2_LEASE_WRITE;
}