summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2022-06-30 16:42:54 +0200
committerRalph Boehme <slow@samba.org>2022-07-26 13:40:34 +0000
commit52720516998091206399e9b2387d8ee8265e4660 (patch)
tree6d550a8f036024d8223f57c08a41e12ac40c7b25
parentb865bb28abedd18d5db0ae3ea31908c75ee1129b (diff)
downloadsamba-52720516998091206399e9b2387d8ee8265e4660.tar.gz
s3:g_lock: always call g_lock_cleanup_shared() before getting stuck on lck.num_shared != 0
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
-rw-r--r--source3/lib/g_lock.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index 07958f30b5e..7e3ecf664f8 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -441,6 +441,8 @@ static NTSTATUS g_lock_trylock(
return NT_STATUS_WAS_LOCKED;
}
+ g_lock_cleanup_shared(&lck);
+
if (lck.num_shared != 0) {
g_lock_get_shared(&lck, 0, blocker);
@@ -494,6 +496,8 @@ noexclusive:
lck.exclusive = self;
+ g_lock_cleanup_shared(&lck);
+
status = g_lock_store(rec, &lck, NULL, NULL, 0);
if (!NT_STATUS_IS_OK(status)) {
DBG_DEBUG("g_lock_store() failed: %s\n",