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
This commit is contained in:
xdavidwu 2020-09-04 17:40:51 +08:00 committed by Marko Mäkelä
parent f0a57acb49
commit 3ee2422624
2 changed files with 2 additions and 0 deletions

View file

@ -2427,6 +2427,7 @@ os_file_set_size(
errno = err;
return false;
case EINVAL:
case EOPNOTSUPP:
/* fall back to the code below */
break;
}

View file

@ -2716,6 +2716,7 @@ os_file_set_size(
errno = err;
return false;
case EINVAL:
case EOPNOTSUPP:
/* fall back to the code below */
break;
}