Commit e3b06156 authored by Marko Mäkelä's avatar Marko Mäkelä

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 10dd290b (MDEV-17380).

Tested by: Matthias Leich
parent eb20e7c9
......@@ -2001,8 +2001,8 @@ fil_ibd_create(
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment