Skip to content

Commit 3ee2422

Browse files
xdavidwudr-m
authored andcommitted
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
1 parent f0a57ac commit 3ee2422

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

storage/innobase/os/os0file.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,6 +2427,7 @@ os_file_set_size(
24272427
errno = err;
24282428
return false;
24292429
case EINVAL:
2430+
case EOPNOTSUPP:
24302431
/* fall back to the code below */
24312432
break;
24322433
}

storage/xtradb/os/os0file.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2716,6 +2716,7 @@ os_file_set_size(
27162716
errno = err;
27172717
return false;
27182718
case EINVAL:
2719+
case EOPNOTSUPP:
27192720
/* fall back to the code below */
27202721
break;
27212722
}

0 commit comments

Comments
 (0)