summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxdavidwu <xdavidwuph@gmail.com>2020-09-04 17:40:51 +0800
committerMarko Mäkelä <marko.makela@mariadb.com>2020-09-04 13:07:45 +0300
commit3ee2422624ffb3d7ffefff8db7ef9398816299bc (patch)
tree298dedcdcd106393f31911cd729530db3f8948bd
parentf0a57acb492c4b034213d37c1fb5943850619f5a (diff)
downloadmariadb-git-3ee2422624ffb3d7ffefff8db7ef9398816299bc.tar.gz
InnoDB, XtraDB: handle EOPNOTSUPP from posix_fallocate()
On some libc (like musl[1]), posix_fallocate() is a fallocate() syscall wrapper, and does not include fallback code like glibc does. In that case, EOPNOTSUPP is returned if underlying filesystem does not support fallocate() with mode = 0. This patch enables falling back to writing zeros when EOPNOTSUPP, fixes some cases like running on filesystem without proper fallocate support on Alpine. [1]: https://git.musl-libc.org/cgit/musl/tree/src/fcntl/posix_fallocate.c?h=v1.2.1
-rw-r--r--storage/innobase/os/os0file.cc1
-rw-r--r--storage/xtradb/os/os0file.cc1
2 files changed, 2 insertions, 0 deletions
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 3a403f880c1..9987544c6a1 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -2427,6 +2427,7 @@ os_file_set_size(
errno = err;
return false;
case EINVAL:
+ case EOPNOTSUPP:
/* fall back to the code below */
break;
}
diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc
index 1e0f28d393f..66af4a39f7c 100644
--- a/storage/xtradb/os/os0file.cc
+++ b/storage/xtradb/os/os0file.cc
@@ -2716,6 +2716,7 @@ os_file_set_size(
errno = err;
return false;
case EINVAL:
+ case EOPNOTSUPP:
/* fall back to the code below */
break;
}