From: Volker Lendecke Date: Tue, 14 Aug 2018 12:31:01 +0000 (+0200) Subject: g_lock: Fix lock upgrades X-Git-Tag: samba-4.7.10~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3297648fa049471cc6b3767e34d9b8731473bd9;p=thirdparty%2Fsamba.git g_lock: Fix lock upgrades 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 Reviewed-by: Stefan Metzmacher --- diff --git a/selftest/knownfail.d/local-g-lock6 b/selftest/knownfail.d/local-g-lock6 deleted file mode 100644 index 14fd5c869d6..00000000000 --- a/selftest/knownfail.d/local-g-lock6 +++ /dev/null @@ -1 +0,0 @@ -^samba3.smbtorture_s3.LOCAL-G-LOCK6.smbtorture diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c index 76b4af5d974..a53f6a16dd0 100644 --- a/source3/lib/g_lock.c +++ b/source3/lib/g_lock.c @@ -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;