MDEV-16548 - Innodb fails to start on older kernels that don't support F_DUPFD_CLOEXEC
InnoDB duplicates file descriptor returned by create_temp_file() to workaround further inconsistent use of this descriptor. Use mysys file descriptors consistently for innobase_mysql_tmpfile(NULL). Mostly close it by appropriate mysys wrappers.
This commit is contained in:
parent
893472d005
commit
5f5a0b3bb6
@ -6436,7 +6436,7 @@ void dict_sys_t::close()
|
||||
|
||||
if (dict_foreign_err_file)
|
||||
{
|
||||
fclose(dict_foreign_err_file);
|
||||
my_fclose(dict_foreign_err_file, MYF(MY_WME));
|
||||
dict_foreign_err_file = NULL;
|
||||
}
|
||||
|
||||
|
@ -557,7 +557,7 @@ void lock_sys_t::close()
|
||||
if (!m_initialised) return;
|
||||
|
||||
if (lock_latest_err_file != NULL) {
|
||||
fclose(lock_latest_err_file);
|
||||
my_fclose(lock_latest_err_file, MYF(MY_WME));
|
||||
lock_latest_err_file = NULL;
|
||||
}
|
||||
|
||||
|
@ -1131,23 +1131,14 @@ os_file_create_tmpfile()
|
||||
{
|
||||
FILE* file = NULL;
|
||||
WAIT_ALLOW_WRITES();
|
||||
os_file_t fd = innobase_mysql_tmpfile(NULL);
|
||||
File fd = mysql_tmpfile("ib");
|
||||
|
||||
if (fd != OS_FILE_CLOSED) {
|
||||
#ifdef _WIN32
|
||||
int crt_fd = _open_osfhandle((intptr_t)HANDLE(fd), 0);
|
||||
if (crt_fd != -1) {
|
||||
file = fdopen(crt_fd, "w+b");
|
||||
if (!file) {
|
||||
close(crt_fd);
|
||||
}
|
||||
}
|
||||
#else
|
||||
file = fdopen(fd, "w+b");
|
||||
if (fd >= 0) {
|
||||
file = my_fdopen(fd, 0, O_RDWR|O_TRUNC|O_CREAT|FILE_BINARY,
|
||||
MYF(MY_WME));
|
||||
if (!file) {
|
||||
close(fd);
|
||||
my_close(fd, MYF(MY_WME));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (file == NULL) {
|
||||
@ -2145,7 +2136,7 @@ and native aio.
|
||||
bool
|
||||
AIO::is_linux_native_aio_supported()
|
||||
{
|
||||
int fd;
|
||||
File fd;
|
||||
io_context_t io_ctx;
|
||||
char name[1000];
|
||||
|
||||
@ -2158,7 +2149,7 @@ AIO::is_linux_native_aio_supported()
|
||||
} else if (!srv_read_only_mode) {
|
||||
|
||||
/* Now check if tmpdir supports native aio ops. */
|
||||
fd = innobase_mysql_tmpfile(NULL);
|
||||
fd = mysql_tmpfile("ib");
|
||||
|
||||
if (fd < 0) {
|
||||
ib::warn()
|
||||
@ -2185,7 +2176,7 @@ AIO::is_linux_native_aio_supported()
|
||||
|
||||
strcpy(name + dirnamelen, "ib_logfile0");
|
||||
|
||||
fd = open(name, O_RDONLY | O_CLOEXEC);
|
||||
fd = my_open(name, O_RDONLY | O_CLOEXEC, MYF(0));
|
||||
|
||||
if (fd == -1) {
|
||||
|
||||
@ -2230,7 +2221,7 @@ AIO::is_linux_native_aio_supported()
|
||||
}
|
||||
|
||||
ut_free(buf);
|
||||
close(fd);
|
||||
my_close(fd, MYF(MY_WME));
|
||||
|
||||
switch (err) {
|
||||
case 1:
|
||||
|
@ -1422,7 +1422,9 @@ dberr_t srv_start(bool create_new_db)
|
||||
fil_path_to_mysql_datadir,
|
||||
os_proc_get_number());
|
||||
|
||||
srv_monitor_file = fopen(srv_monitor_file_name, "w+");
|
||||
srv_monitor_file = my_fopen(srv_monitor_file_name,
|
||||
O_RDWR|O_TRUNC|O_CREAT,
|
||||
MYF(MY_WME));
|
||||
|
||||
if (!srv_monitor_file) {
|
||||
ib::error() << "Unable to create "
|
||||
@ -2458,7 +2460,7 @@ void innodb_shutdown()
|
||||
srv_shutdown_all_bg_threads();
|
||||
|
||||
if (srv_monitor_file) {
|
||||
fclose(srv_monitor_file);
|
||||
my_fclose(srv_monitor_file, MYF(MY_WME));
|
||||
srv_monitor_file = 0;
|
||||
if (srv_monitor_file_name) {
|
||||
unlink(srv_monitor_file_name);
|
||||
@ -2467,7 +2469,7 @@ void innodb_shutdown()
|
||||
}
|
||||
|
||||
if (srv_misc_tmpfile) {
|
||||
fclose(srv_misc_tmpfile);
|
||||
my_fclose(srv_misc_tmpfile, MYF(MY_WME));
|
||||
srv_misc_tmpfile = 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user