summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Lesin <vlad_lesin@mail.ru>2023-05-12 17:20:03 +0300
committerVlad Lesin <vlad_lesin@mail.ru>2023-05-17 12:12:15 +0300
commit91f7c1a87029d81a240e991cde3a3595ae7fca77 (patch)
treeb1e5f6f4058352a0f6e860aa77a931726973cb9e
parentc9eff1a144ba44846373660a30d342d3f0dc91a5 (diff)
downloadmariadb-git-bb-10.5-MDEV-31256-fil_node_open_file.tar.gz
MDEV-31256 fil_node_open_file() releases fil_system.mutex allowing other thread to open its file nodebb-10.5-MDEV-31256-fil_node_open_file
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.
-rw-r--r--storage/innobase/fil/fil0fil.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index fd2404a009a..58261d27d8e 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -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. */