diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2022-10-31 13:34:25 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2022-10-31 13:34:25 +0530 |
commit | 7be88ea746c801c7a94550907e211767d73f0397 (patch) | |
tree | ec8e070235472ffc7b3e59aed9f90b3a95679356 | |
parent | 18a0f0c17839e3662ac86a22975ae45886ae4cf6 (diff) | |
download | mariadb-git-7be88ea746c801c7a94550907e211767d73f0397.tar.gz |
MDEV-29518 ASAN Failure on i_s query when tablespace does rename operation
- InnoDB information schema query access the tablespace name after
getting freed by concurrent rename operation. To avoid this, InnoDB
should take exclusive tablespace latch during rename operation
and I_S query should take shared tablespace latch before accessing
the name
-rw-r--r-- | storage/innobase/dict/dict0dict.cc | 2 | ||||
-rw-r--r-- | storage/innobase/handler/i_s.cc | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index b74cd043439..43ccf8c4d09 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -1488,6 +1488,7 @@ dict_table_t::rename_tablespace(span<const char> new_name, bool replace) const err= DB_TABLESPACE_EXISTS; else { + space->x_lock(); err= space->rename(path, true, replace); if (data_dir) { @@ -1495,6 +1496,7 @@ dict_table_t::rename_tablespace(span<const char> new_name, bool replace) const new_name= {name.m_name, strlen(name.m_name)}; RemoteDatafile::delete_link_file(new_name); } + space->x_unlock(); } ut_free(path); diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 82b8968876f..bb2f1b6beda 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -6491,7 +6491,9 @@ static int i_s_sys_tablespaces_fill_table(THD *thd, TABLE_LIST *tables, Item*) { space.reacquire(); mysql_mutex_unlock(&fil_system.mutex); + space.s_lock(); err= i_s_sys_tablespaces_fill(thd, space, tables->table); + space.s_unlock(); mysql_mutex_lock(&fil_system.mutex); space.release(); if (err) @@ -6719,8 +6721,10 @@ i_s_tablespaces_encryption_fill_table( && !space.is_stopping()) { space.reacquire(); mysql_mutex_unlock(&fil_system.mutex); + space.s_lock(); err = i_s_dict_fill_tablespaces_encryption( thd, &space, tables->table); + space.s_unlock(); mysql_mutex_lock(&fil_system.mutex); space.release(); if (err) { |