summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-03-14 13:34:07 -0700
committerRalph Boehme <slow@samba.org>2017-03-15 20:04:32 +0100
commit1c4b15aa5f6707e7bcfc21435e26929fb7f45c0f (patch)
tree401f8a85a68bdf6518c899ee35b01cb06bfa5fd2 /source3/locking
parent125c78ad0b8f9caaef1ba2f1aeb5ec593375fccd (diff)
downloadsamba-1c4b15aa5f6707e7bcfc21435e26929fb7f45c0f.tar.gz
s3: locking: Update oplock optimization for the leases era !
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12628 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Wed Mar 15 20:04:32 CET 2017 on sn-devel-144
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/locking.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index e540ab4dcd8..51c16405892 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -119,17 +119,21 @@ bool strict_lock_default(files_struct *fsp, struct lock_struct *plock)
}
if (strict_locking == Auto) {
- if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type) &&
- (plock->lock_type == READ_LOCK ||
- plock->lock_type == WRITE_LOCK)) {
- DEBUG(10, ("is_locked: optimisation - exclusive oplock "
- "on file %s\n", fsp_str_dbg(fsp)));
+ uint32_t lease_type = fsp_lease_type(fsp);
+
+ if ((lease_type & SMB2_LEASE_READ) &&
+ (plock->lock_type == READ_LOCK))
+ {
+ DBG_DEBUG("optimisation - read lease on file %s\n",
+ fsp_str_dbg(fsp));
return true;
}
- if ((fsp->oplock_type == LEVEL_II_OPLOCK) &&
- (plock->lock_type == READ_LOCK)) {
- DEBUG(10, ("is_locked: optimisation - level II oplock "
- "on file %s\n", fsp_str_dbg(fsp)));
+
+ if ((lease_type & SMB2_LEASE_WRITE) &&
+ (plock->lock_type == WRITE_LOCK))
+ {
+ DBG_DEBUG("optimisation - write lease on file %s\n",
+ fsp_str_dbg(fsp));
return true;
}
}