Skip to content

Commit

Permalink
MDEV-22950 followup
Browse files Browse the repository at this point in the history
Deadlock in DbugParse, on Linux.

In 10.1, DBUG recursive mutex was improperly implemented.
CODE_STATE::locked counter was never updated.

Copy the code around LockMutex/UnlockMutex from 10.2
  • Loading branch information
vaintroub committed Jun 25, 2020
1 parent f183843 commit 7ee6a3a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dbug/dbug.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,13 @@ static void LockMutex(CODE_STATE *cs)
{
if (!cs->locked)
pthread_mutex_lock(&THR_LOCK_dbug);
cs->locked++;
}
static void UnlockMutex(CODE_STATE *cs)
{
if (!cs->locked)
--cs->locked;
assert(cs->locked >= 0);
if (cs->locked == 0)
pthread_mutex_unlock(&THR_LOCK_dbug);
}
static void LockIfInitSettings(CODE_STATE *cs)
Expand Down

0 comments on commit 7ee6a3a

Please sign in to comment.