Commit 3aea77ed 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_space_t::add(): If a file handle was passed, invoke
fil_node_t::find_metadata() before releasing fil_system.mutex.
The call was moved from fil_ibd_create().

This is a 10.5 version of commit e3b06156
from 10.6.
parent 383105da
......@@ -350,6 +350,7 @@ fil_node_t* fil_space_t::add(const char* name, pfs_os_file_t handle,
this->size += size;
UT_LIST_ADD_LAST(chain, node);
if (node->is_open()) {
node->find_metadata(node->handle);
n_pending.fetch_and(~CLOSING, std::memory_order_relaxed);
if (++fil_system.n_open >= srv_max_n_open_files) {
reacquire();
......@@ -2433,7 +2434,6 @@ fil_ibd_create(
mtr.log_file_op(FILE_CREATE, space_id, node->name);
mtr.commit();
node->find_metadata(file);
*err = DB_SUCCESS;
return space;
}
......
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