lib: Fix contending with a READ lock
authorVolker Lendecke <vl@samba.org>
Fri, 20 Dec 2019 15:20:00 +0000 (16:20 +0100)
committerJeremy Allison <jra@samba.org>
Sun, 22 Dec 2019 18:57:17 +0000 (18:57 +0000)
When contending a WRITE with an existing READ, the contender puts
himself into the exclusive slot, waiting for the READers to go
away. If the async lock request is canceled before we got the lock, we
need to remove ourselves again. This is done in the destructor of the
g_lock_lock_state. In the successful case, the destructor needs to go
away.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Dec 22 18:57:17 UTC 2019 on sn-devel-184

selftest/knownfail.d/g-lock4a [deleted file]
source3/lib/g_lock.c

diff --git a/selftest/knownfail.d/g-lock4a b/selftest/knownfail.d/g-lock4a
deleted file mode 100644 (file)
index fd5537d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-samba3.smbtorture_s3.LOCAL-G-LOCK4A
\ No newline at end of file
index 1f4dcda2605a3e8c3a521fed0ef16e1fdf55888f..4bf30188a43e2c568dc6495ebefe81ed232a3724 100644 (file)
@@ -419,6 +419,8 @@ static NTSTATUS g_lock_trylock(
                        return NT_STATUS_LOCK_NOT_GRANTED;
                }
 
+               talloc_set_destructor(req_state, NULL);
+
                /*
                 * Retry after a conflicting lock was released
                 */