Commit 7db99932 authored by Eugene Kosov's avatar Eugene Kosov

MDEV-20183 data race at safe_mutex_lock()

fix is simple: just move mp->file under mp->global protection
parent 51d58f56
...@@ -237,6 +237,8 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file, ...@@ -237,6 +237,8 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
int error; int error;
DBUG_PRINT("mutex", ("%s (0x%lx) locking", mp->name ? mp->name : "Null", DBUG_PRINT("mutex", ("%s (0x%lx) locking", mp->name ? mp->name : "Null",
(ulong) mp)); (ulong) mp));
pthread_mutex_lock(&mp->global);
if (!mp->file) if (!mp->file)
{ {
fprintf(stderr, fprintf(stderr,
...@@ -245,8 +247,6 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file, ...@@ -245,8 +247,6 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
fflush(stderr); fflush(stderr);
abort(); abort();
} }
pthread_mutex_lock(&mp->global);
if (mp->count > 0) if (mp->count > 0)
{ {
/* /*
......
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