summaryrefslogtreecommitdiff
path: root/storage/innobase/fil/fil0crypt.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-08-31 11:08:43 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-08-31 11:08:43 +0300
commit38ca9be4de38a4a6688985f3f73d75a2a75665f4 (patch)
treed887745a37193b541e49fddd1f22eebd2a44f9a5 /storage/innobase/fil/fil0crypt.cc
parent28b2896a434670d7b03c4a5e3fba8b4f3872a297 (diff)
downloadmariadb-git-38ca9be4de38a4a6688985f3f73d75a2a75665f4.tar.gz
MDEV-13684 InnoDB race condition between fil_crypt_thread and btr_scrub_init
There is a race condition in InnoDB startup. A number of fil_crypt_thread are created by fil_crypt_threads_init(). These threads may call btr_scrub_complete_space() before btr_scrub_init() was called. Those too early calls would be accessing an uninitialized scrub_stat_mutex. innobase_start_or_create_for_mysql(): Invoke btr_scrub_init() before fil_crypt_threads_init(). fil_crypt_complete_rotate_space(): Only invoke btr_scrub_complete_space() if scrubbing is enabled. There is no need to update the statistics if it is not enabled.
Diffstat (limited to 'storage/innobase/fil/fil0crypt.cc')
-rw-r--r--storage/innobase/fil/fil0crypt.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index a388ce4b604..25966e17e75 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -2127,7 +2127,8 @@ fil_crypt_complete_rotate_space(
mutex_exit(&crypt_data->mutex);
/* all threads must call btr_scrub_complete_space wo/ mutex held */
- if (btr_scrub_complete_space(&state->scrub_data) == true) {
+ if (state->scrub_data.scrubbing) {
+ btr_scrub_complete_space(&state->scrub_data);
if (should_flush) {
/* only last thread updates last_scrub_completed */
ut_ad(crypt_data);