summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-03-03 11:47:31 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-03-03 11:47:31 +0200
commit6b8173b6e97f14509f54c908ae0a714eb6ac1316 (patch)
tree118c834a4f00f9c3f1993250e72169f6b84eb39d /storage
parent75f6067e89d7a777e7c1a1580a833aacc501d290 (diff)
downloadmariadb-git-6b8173b6e97f14509f54c908ae0a714eb6ac1316.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.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/fil/fil0fil.c6
-rw-r--r--storage/innobase/os/os0file.c6
-rw-r--r--storage/xtradb/fil/fil0fil.c6
-rw-r--r--storage/xtradb/os/os0file.c6
4 files changed, 20 insertions, 4 deletions
diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
index 46338b079da..4006ce4acce 100644
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.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;
diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
index 72b9651f596..90bebdb2374 100644
--- a/storage/innobase/os/os0file.c
+++ b/storage/innobase/os/os0file.c
@@ -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"
diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c
index 3a45cc6c098..004a80e9b13 100644
--- a/storage/xtradb/fil/fil0fil.c
+++ b/storage/xtradb/fil/fil0fil.c
@@ -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;
diff --git a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c
index 201e4487ada..922a5adeda6 100644
--- a/storage/xtradb/os/os0file.c
+++ b/storage/xtradb/os/os0file.c
@@ -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"