]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Revert "s3: locking: Update oplock optimization for the leases era !"
authorStefan Metzmacher <metze@samba.org>
Wed, 12 Jul 2017 06:47:33 +0000 (08:47 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 12 Jul 2017 06:50:24 +0000 (08:50 +0200)
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 <metze@samba.org>
source3/locking/locking.c

index e6d3918db79b41cd694f7588b23371e4105765d3..5a9746094baefbc34ed31c51cac1bb19d645533f 100644 (file)
@@ -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;
                }
        }