1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00

smbd: Optimize delay_for_oplock()

get_lease_type() can involve a database access. Do that only if
necessary, and that is at most once in this loop.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2019-08-10 14:44:08 +02:00 committed by Jeremy Allison
parent 38463a91aa
commit 9034cb39d7

View File

@ -2264,9 +2264,6 @@ static NTSTATUS grant_fsp_oplock_type(struct smb_request *req,
for (i=0; i<d->num_share_modes; i++) {
struct share_mode_entry *e = &d->share_modes[i];
uint32_t e_lease_type;
e_lease_type = get_lease_type(d, e);
if ((granted & SMB2_LEASE_WRITE) &&
!is_same_lease(fsp, d, e, lease) &&
@ -2277,9 +2274,12 @@ static NTSTATUS grant_fsp_oplock_type(struct smb_request *req,
granted &= ~SMB2_LEASE_WRITE;
}
if ((e_lease_type & SMB2_LEASE_HANDLE) && !got_handle_lease &&
!share_mode_stale_pid(d, i)) {
got_handle_lease = true;
if (!got_handle_lease) {
uint32_t e_lease_type = get_lease_type(d, e);
if ((e_lease_type & SMB2_LEASE_HANDLE) &&
!share_mode_stale_pid(d, i)) {
got_handle_lease = true;
}
}
if ((e->op_type != LEASE_OPLOCK) && !got_oplock &&