diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2020-06-25 09:58:42 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2020-06-25 10:00:15 +0200 |
commit | 7ee6a3ae5f805d84df6d5c78856b34fa9c2696a4 (patch) | |
tree | c862f3e6f6cbe6df9adc6b042a6d708543a293aa /dbug | |
parent | f1838434b85db2d640ee21d0cbc2a4df1dc550e1 (diff) | |
download | mariadb-git-7ee6a3ae5f805d84df6d5c78856b34fa9c2696a4.tar.gz |
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
Diffstat (limited to 'dbug')
-rw-r--r-- | dbug/dbug.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c index b0e1b0eaae6..007769c3c37 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -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) |