s3/smbd: update exclusive oplock optimisation to the lease area
authorRalph Boehme <slow@samba.org>
Thu, 20 Apr 2017 19:37:37 +0000 (21:37 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 9 May 2017 08:17:08 +0000 (10:17 +0200)
This is similar to 9533a55ee5ffe430589dcea845851b84876ef656 but this
time in the contend_level2_oplocks_begin_default() function.

The idea of the optimisation is to avoid expensive db queries in
locking.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>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 0a4a08ad1cef3b7d6fd47df3a93c2c89dd287ee8)

source3/smbd/oplock.c

index 57b53f82c17f5516dc1b52441e03be3e2d280936..fb5abfe3a7a7eb03216e98aef38a3fcf6162732a 100644 (file)
@@ -1043,7 +1043,7 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp,
         * the shared memory area whilst doing this.
         */
 
-       if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
+       if (fsp_lease_type_is_exclusive(fsp)) {
                /*
                 * There can't be any level2 oplocks, we're alone.
                 */