summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-03-03 12:03:33 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-03-03 12:03:33 +0200
commit29c776cfd1e560846e394f39d79ae43ff7d70c61 (patch)
treef53fecb2ec18c6b9102e8c428c2dc950661a44b0
parentd04d835f64b39edf0310e0471a7ed261b5cb2a20 (diff)
downloadmariadb-git-29c776cfd1e560846e394f39d79ae43ff7d70c61.tar.gz
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.
-rw-r--r--storage/innobase/fil/fil0fil.cc7
-rw-r--r--storage/innobase/os/os0file.cc7
-rw-r--r--storage/xtradb/fil/fil0fil.cc7
-rw-r--r--storage/xtradb/os/os0file.cc7
4 files changed, 24 insertions, 4 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index b0d489cf701..72ee8d74a82 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -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"
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 9fdd52bf736..eb8b3a53d32 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -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"
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index 3b0b1da57e9..1a866a693ca 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -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"
diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc
index 5e7a0251a00..bed201991e9 100644
--- a/storage/xtradb/os/os0file.cc
+++ b/storage/xtradb/os/os0file.cc
@@ -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"