Commit 29c776cf 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 d04d835f
......@@ -5023,7 +5023,12 @@ fil_extend_space_to_desired_size(
= size_after_extend - start_page_no;
const os_offset_t len = os_offset_t(n_pages) * 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;
if (!success) {
ib_logf(IB_LOG_LEVEL_ERROR, "extending file %s"
......
......@@ -2130,7 +2130,12 @@ os_file_set_size(
#ifdef HAVE_POSIX_FALLOCATE
if (srv_use_posix_fallocate) {
int err = posix_fallocate(file, 0, size);
int err;
do {
err = posix_fallocate(file, 0, size);
} while (err == EINTR
&& srv_shutdown_state == SRV_SHUTDOWN_NONE);
if (err) {
ib_logf(IB_LOG_LEVEL_ERROR,
"preallocating " INT64PF " bytes for"
......
......@@ -5063,7 +5063,12 @@ fil_extend_space_to_desired_size(
= size_after_extend - start_page_no;
const os_offset_t len = os_offset_t(n_pages) * 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;
if (!success) {
ib_logf(IB_LOG_LEVEL_ERROR, "extending file %s"
......
......@@ -2348,7 +2348,12 @@ os_file_set_size(
#ifdef HAVE_POSIX_FALLOCATE
if (srv_use_posix_fallocate) {
int err = posix_fallocate(file, 0, size);
int err;
do {
err = posix_fallocate(file, 0, size);
} while (err == EINTR
&& srv_shutdown_state == SRV_SHUTDOWN_NONE);
if (err) {
ib_logf(IB_LOG_LEVEL_ERROR,
"preallocating " INT64PF " 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