Commit 6b8173b6 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-11520: Retry posix_fallocate() after EINTR.

The function posix_fallocate() as well as the Linux system call
fallocate() can return EINTR when the operation was interrupted
by a signal. In that case, keep retrying the operation, except
if InnoDB shutdown has been initiated.
parent 75f6067e
...@@ -4140,7 +4140,11 @@ fil_extend_space_to_desired_size( ...@@ -4140,7 +4140,11 @@ fil_extend_space_to_desired_size(
= (start_page_no - file_start_page_no) * page_size; = (start_page_no - file_start_page_no) * page_size;
ib_int64_t len ib_int64_t len
= (size_after_extend - start_page_no) * page_size; = (size_after_extend - start_page_no) * page_size;
int err = posix_fallocate(node->handle, start_offset, len); int err;
do {
err = posix_fallocate(node->handle, start_offset, len);
} while (err == EINTR
&& srv_shutdown_state == SRV_SHUTDOWN_NONE);
success = !err; success = !err;
......
...@@ -2032,7 +2032,11 @@ os_file_set_size( ...@@ -2032,7 +2032,11 @@ os_file_set_size(
#ifdef HAVE_POSIX_FALLOCATE #ifdef HAVE_POSIX_FALLOCATE
if (srv_use_posix_fallocate) { if (srv_use_posix_fallocate) {
int err = posix_fallocate(file, 0, desired_size); int err;
do {
err = posix_fallocate(file, 0, desired_size);
} while (err == EINTR
&& srv_shutdown_state == SRV_SHUTDOWN_NONE);
if (err) { if (err) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: preallocating %lld bytes for" "InnoDB: Error: preallocating %lld bytes for"
......
...@@ -4975,7 +4975,11 @@ fil_extend_space_to_desired_size( ...@@ -4975,7 +4975,11 @@ fil_extend_space_to_desired_size(
= (start_page_no - file_start_page_no) * page_size; = (start_page_no - file_start_page_no) * page_size;
ib_int64_t len ib_int64_t len
= (size_after_extend - start_page_no) * page_size; = (size_after_extend - start_page_no) * page_size;
int err = posix_fallocate(node->handle, start_offset, len); int err;
do {
err = posix_fallocate(node->handle, start_offset, len);
} while (err == EINTR
&& srv_shutdown_state == SRV_SHUTDOWN_NONE);
success = !err; success = !err;
......
...@@ -2189,7 +2189,11 @@ os_file_set_size( ...@@ -2189,7 +2189,11 @@ os_file_set_size(
#ifdef HAVE_POSIX_FALLOCATE #ifdef HAVE_POSIX_FALLOCATE
if (srv_use_posix_fallocate) { if (srv_use_posix_fallocate) {
int err = posix_fallocate(file, 0, desired_size); int err;
do {
err = posix_fallocate(file, 0, desired_size);
} while (err == EINTR
&& srv_shutdown_state == SRV_SHUTDOWN_NONE);
if (err) { if (err) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: preallocating %lld bytes for" "InnoDB: Error: preallocating %lld bytes for"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment