Commit 7ee6a3ae authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-22950 followup

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
parent f1838434
...@@ -330,10 +330,13 @@ static void LockMutex(CODE_STATE *cs) ...@@ -330,10 +330,13 @@ static void LockMutex(CODE_STATE *cs)
{ {
if (!cs->locked) if (!cs->locked)
pthread_mutex_lock(&THR_LOCK_dbug); pthread_mutex_lock(&THR_LOCK_dbug);
cs->locked++;
} }
static void UnlockMutex(CODE_STATE *cs) 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); pthread_mutex_unlock(&THR_LOCK_dbug);
} }
static void LockIfInitSettings(CODE_STATE *cs) static void LockIfInitSettings(CODE_STATE *cs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment