From 8d23e3321d7c7013530969d354b8e47f1724ba93 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 12 Jul 2017 08:47:33 +0200 Subject: [PATCH] Revert "s3: locking: Update oplock optimization for the leases era !" This reverts commit 2e00feb278e174fd28d003c4d5a576f91c0bd7d0. This should not have been in 4-4-test, see https://bugzilla.samba.org/show_bug.cgi?id=12628#c6 v4-4-test is in the security fixes only mode. This also introduces a regression that's fixed in v4-5 and higer only, see https://bugzilla.samba.org/show_bug.cgi?id=12798 Signed-off-by: Stefan Metzmacher --- source3/locking/locking.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/source3/locking/locking.c b/source3/locking/locking.c index e6d3918db79..5a9746094ba 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -118,21 +118,17 @@ bool strict_lock_default(files_struct *fsp, struct lock_struct *plock) } if (strict_locking == Auto) { - 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)); + 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))); return true; } - - if ((lease_type & SMB2_LEASE_WRITE) && - (plock->lock_type == WRITE_LOCK)) - { - DBG_DEBUG("optimisation - write lease on file %s\n", - fsp_str_dbg(fsp)); + 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))); return true; } }