MDEV-31256 fil_node_open_file() releases fil_system.mutex allowing other 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.
This commit is contained in:
Vlad Lesin 2023-05-12 17:20:03 +03:00
parent 06d555a41a
commit 5422784792

View file

@ -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. */