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.
This commit is contained in:
Marko Mäkelä 2017-03-03 12:03:33 +02:00
parent d04d835f64
commit 29c776cfd1
4 changed files with 24 additions and 4 deletions

View File

@ -5023,7 +5023,12 @@ retry:
= 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"

View File

@ -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"

View File

@ -5063,7 +5063,12 @@ retry:
= 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"

View File

@ -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"