1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

MDEV-31347 fil_ibd_create() may hijack the file handle of an old file

fil_ibd_create(): Hold fil_system.mutex until fil_node_t::find_metadata()
has completed, so that node->handle cannot be closed by a concurrent
thread. This race condition was introduced
in commit 10dd290b4b (MDEV-17380).

Tested by: Matthias Leich
This commit is contained in:
Marko Mäkelä
2023-05-31 15:25:07 +03:00
parent eb20e7c900
commit e3b06156c6

View File

@@ -2001,8 +2001,8 @@ err_exit:
FIL_TYPE_TABLESPACE,
crypt_data, mode, true)) {
fil_node_t* node = space->add(path, file, size, false, true);
mysql_mutex_unlock(&fil_system.mutex);
IF_WIN(node->find_metadata(), node->find_metadata(file, true));
mysql_mutex_unlock(&fil_system.mutex);
mtr.start();
mtr.set_named_space(space);
ut_a(fsp_header_init(space, size, &mtr) == DB_SUCCESS);