From 3ee2422624ffb3d7ffefff8db7ef9398816299bc Mon Sep 17 00:00:00 2001 From: xdavidwu Date: Fri, 4 Sep 2020 17:40:51 +0800 Subject: [PATCH] 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 --- storage/innobase/os/os0file.cc | 1 + storage/xtradb/os/os0file.cc | 1 + 2 files changed, 2 insertions(+) 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; }