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
(cherry picked from commit
a50343779a8a92d6f53095b36506b1d47ef68513)
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;
}