g_lock: Fix lock upgrades
authorVolker Lendecke <vl@samba.org>
Tue, 14 Aug 2018 12:31:01 +0000 (14:31 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 23 Aug 2018 08:39:30 +0000 (10:39 +0200)
Master has changed significantly, this is a minimum fix for 4.7 without
cleaning up the code

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13195

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
selftest/knownfail.d/local-g-lock6 [deleted file]
source3/lib/g_lock.c

diff --git a/selftest/knownfail.d/local-g-lock6 b/selftest/knownfail.d/local-g-lock6
deleted file mode 100644 (file)
index 14fd5c8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.smbtorture_s3.LOCAL-G-LOCK6.smbtorture
index 76b4af5d974cabab4458358bb26bfae81ca6485f..a53f6a16dd0a78260f094fcfcc56bcd6528dedba 100644 (file)
@@ -329,6 +329,10 @@ static NTSTATUS g_lock_trylock(struct db_record *rec, struct server_id self,
                         * Delete stale conflicting entry
                         */
                        locks[i] = locks[num_locks-1];
+                       if (my_lock == num_locks-1) {
+                               /* We just moved */
+                               my_lock = i;
+                       }
                        num_locks -= 1;
                        modified = true;
                        continue;