diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-03-07 13:21:02 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-03-07 13:21:02 +0100 |
commit | 2db62f686e148f09fe5fd0b385fc71f2a3c4a133 (patch) | |
tree | cf1d5d6f0d05f1b50be96d943476173228cbd458 /storage/innobase/include/sync0rw.ic | |
parent | 143f5d9172647a43cdcf5c27b8a78f32c9f639c0 (diff) | |
parent | d61573d3e5c8f9d85b88f9fa2e79160b159bf67d (diff) | |
download | mariadb-git-2db62f686e148f09fe5fd0b385fc71f2a3c4a133.tar.gz |
Merge branch '10.0' into 10.1
Diffstat (limited to 'storage/innobase/include/sync0rw.ic')
-rw-r--r-- | storage/innobase/include/sync0rw.ic | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic index afd25f3a071..8c4e938002a 100644 --- a/storage/innobase/include/sync0rw.ic +++ b/storage/innobase/include/sync0rw.ic @@ -392,6 +392,7 @@ rw_lock_x_lock_func_nowait( ulint line) /*!< in: line where requested */ { ibool success; + ibool local_recursive= lock->recursive; #ifdef INNODB_RW_LOCKS_USE_ATOMICS success = os_compare_and_swap_lint(&lock->lock_word, X_LOCK_DECR, 0); @@ -406,10 +407,14 @@ rw_lock_x_lock_func_nowait( mutex_exit(&(lock->mutex)); #endif + /* Note: recursive must be loaded before writer_thread see + comment for rw_lock_set_writer_id_and_recursion_flag(). + To achieve this we load it before os_compare_and_swap_lint(), + which implies full memory barrier in current implementation. */ if (success) { rw_lock_set_writer_id_and_recursion_flag(lock, TRUE); - } else if (lock->recursive + } else if (local_recursive && os_thread_eq(lock->writer_thread, os_thread_get_curr_id())) { /* Relock: this lock_word modification is safe since no other |