From: Volker Lendecke Date: Fri, 20 Dec 2019 15:20:00 +0000 (+0100) Subject: lib: Fix contending with a READ lock X-Git-Tag: ldb-2.1.0~143 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40ecc2f6f015b86b49326bff4b1cbcab8263f1ac;p=thirdparty%2Fsamba.git lib: Fix contending with a READ lock 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 Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Sun Dec 22 18:57:17 UTC 2019 on sn-devel-184 --- diff --git a/selftest/knownfail.d/g-lock4a b/selftest/knownfail.d/g-lock4a deleted file mode 100644 index fd5537d869d..00000000000 --- a/selftest/knownfail.d/g-lock4a +++ /dev/null @@ -1 +0,0 @@ -samba3.smbtorture_s3.LOCAL-G-LOCK4A \ No newline at end of file diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c index 1f4dcda2605..4bf30188a43 100644 --- a/source3/lib/g_lock.c +++ b/source3/lib/g_lock.c @@ -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 */