Skip to content
Permalink
Browse files

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.
  • Loading branch information...
dr-m committed Mar 3, 2017
1 parent 75f6067 commit 6b8173b6e97f14509f54c908ae0a714eb6ac1316
Showing with 20 additions and 4 deletions.
  1. +5 −1 storage/innobase/fil/fil0fil.c
  2. +5 −1 storage/innobase/os/os0file.c
  3. +5 −1 storage/xtradb/fil/fil0fil.c
  4. +5 −1 storage/xtradb/os/os0file.c
@@ -4140,7 +4140,11 @@ fil_extend_space_to_desired_size(
= (start_page_no - file_start_page_no) * page_size;
ib_int64_t len
= (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;

@@ -2032,7 +2032,11 @@ os_file_set_size(

#ifdef HAVE_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) {
fprintf(stderr,
"InnoDB: Error: preallocating %lld bytes for"
@@ -4975,7 +4975,11 @@ fil_extend_space_to_desired_size(
= (start_page_no - file_start_page_no) * page_size;
ib_int64_t len
= (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;

@@ -2189,7 +2189,11 @@ os_file_set_size(

#ifdef HAVE_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) {
fprintf(stderr,
"InnoDB: Error: preallocating %lld bytes for"

0 comments on commit 6b8173b

Please sign in to comment.
You can’t perform that action at this time.