mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
MDEV-10341: InnoDB: Failing assertion: mutex_own(mutex) - mutex_exit_func
Fix memory barrier issues on releasing mutexes. We must have a full memory barrier between releasing a mutex lock and reading its waiters. This prevents us from missing to release waiters due to reading the number of waiters speculatively before releasing the lock. If threads try and wait between us reading the waiters count and releasing the lock, those threads might stall indefinitely. Also, we must use proper ACQUIRE/RELEASE semantics for atomic operations, not ACQUIRE/ACQUIRE.
This commit is contained in:
parent
0098d789c9
commit
5ad02062d9
4 changed files with 14 additions and 18 deletions
|
|
@ -178,6 +178,11 @@ mutex_exit_func(
|
|||
to wake up possible hanging threads if
|
||||
they are missed in mutex_signal_object. */
|
||||
|
||||
/* We add a memory barrier to prevent reading of the
|
||||
number of waiters before releasing the lock. */
|
||||
|
||||
os_mb;
|
||||
|
||||
if (mutex_get_waiters(mutex) != 0) {
|
||||
|
||||
mutex_signal_object(mutex);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue