Skip to content

Commit e3b0615

Browse files
committed
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 10dd290 (MDEV-17380). Tested by: Matthias Leich
1 parent eb20e7c commit e3b0615

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

storage/innobase/fil/fil0fil.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2001,8 +2001,8 @@ fil_ibd_create(
20012001
FIL_TYPE_TABLESPACE,
20022002
crypt_data, mode, true)) {
20032003
fil_node_t* node = space->add(path, file, size, false, true);
2004-
mysql_mutex_unlock(&fil_system.mutex);
20052004
IF_WIN(node->find_metadata(), node->find_metadata(file, true));
2005+
mysql_mutex_unlock(&fil_system.mutex);
20062006
mtr.start();
20072007
mtr.set_named_space(space);
20082008
ut_a(fsp_header_init(space, size, &mtr) == DB_SUCCESS);

0 commit comments

Comments
 (0)