Skip to content

Commit

Permalink
MDEV-31256 fil_node_open_file() releases fil_system.mutex allowing ot…
Browse files Browse the repository at this point in the history
…her thread to open its file node

There is room between mutex_exit(&fil_system.mutex) and
mutex_enter(&fil_system.mutex) calls in fil_node_open_file(). During this
room another thread can open the node, and ut_ad(!node->is_open())
assertion in fil_node_open_file_low() can fail.

The fix is not to open node if it was already opened by another thread.
  • Loading branch information
vlad-lesin committed May 19, 2023
1 parent 06d555a commit 5422784
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion storage/innobase/fil/fil0fil.cc
Expand Up @@ -458,7 +458,9 @@ static bool fil_node_open_file(fil_node_t *node)
}
}

return fil_node_open_file_low(node);
/* The node can be opened beween releasing and acquiring fil_system.mutex
in the above code */
return node->is_open() || fil_node_open_file_low(node);
}

/** Close the file handle. */
Expand Down

0 comments on commit 5422784

Please sign in to comment.