Fix test and set/release of InnoDB mutex lock_word likely due to missing a memory barrier, this was using test and set rather than sync lock release. Also add memory barrier in for get lock word. Index: mysql-5.6.17/storage/innobase/include/sync0sync.ic =================================================================== --- mysql-5.6.17.orig/storage/innobase/include/sync0sync.ic +++ mysql-5.6.17/storage/innobase/include/sync0sync.ic @@ -80,7 +80,7 @@ ib_mutex_test_and_set( ib_mutex_t* mutex) /*!< in: mutex */ { #if defined(HAVE_ATOMIC_BUILTINS) - return(os_atomic_test_and_set_byte(&mutex->lock_word, 1)); + return(__sync_lock_test_and_set(&mutex->lock_word, 1)); #else ibool ret; @@ -112,7 +112,7 @@ mutex_reset_lock_word( /* In theory __sync_lock_release should be used to release the lock. Unfortunately, it does not work properly alone. The workaround is that more conservative __sync_lock_test_and_set is used instead. */ - os_atomic_test_and_set_byte(&mutex->lock_word, 0); + __sync_lock_release(&mutex->lock_word); #else mutex->lock_word = 0; @@ -130,6 +130,7 @@ mutex_get_lock_word( { ut_ad(mutex); + os_rmb; return(mutex->lock_word); }