]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:g_lock: always call g_lock_cleanup_shared() before getting stuck on lck.num_shared...
authorStefan Metzmacher <metze@samba.org>
Thu, 30 Jun 2022 14:42:54 +0000 (16:42 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 26 Jul 2022 13:40:34 +0000 (13:40 +0000)
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>
source3/lib/g_lock.c

index 07958f30b5e543d01c4c79c1ac964e1a191ed082..7e3ecf664f8e80e757ebc05955faa923231e465d 100644 (file)
@@ -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",