1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

s3/smbd: update exclusive oplock optimisation to the lease area

Update an optimisation in update_num_read_oplocks() that checks for
exclusive oplocks to the lease area.

The idea of the optimisation is to avoid expensive db queries in
brlock.tdb if we *know* we're the only open.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12766

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat May  6 22:58:47 CEST 2017 on sn-devel-144
This commit is contained in:
Ralph Boehme 2017-05-04 11:52:16 +02:00
parent 0a4a08ad1c
commit a50343779a

View File

@ -166,13 +166,18 @@ bool update_num_read_oplocks(files_struct *fsp, struct share_mode_lock *lck)
uint32_t num_read_oplocks = 0;
uint32_t i;
if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
if (fsp_lease_type_is_exclusive(fsp)) {
/*
* If we're the only one, we don't need a brlock entry
* If we're fully exclusive, we don't need a brlock entry
*/
remove_stale_share_mode_entries(d);
SMB_ASSERT(d->num_share_modes == 1);
SMB_ASSERT(EXCLUSIVE_OPLOCK_TYPE(d->share_modes[0].op_type));
for (i=0; i<d->num_share_modes; i++) {
struct share_mode_entry *e = &d->share_modes[i];
uint32_t e_lease_type = get_lease_type(d, e);
SMB_ASSERT(lease_type_is_exclusive(e_lease_type));
}
return true;
}