From: Jakub Jirutka Date: Fri, 27 May 2022 22:37:25 +0000 (+0200) Subject: lib/cache: handle posix_fallocate returning EOPNOTSUPP (Linux/musl) X-Git-Tag: v5.5.1~10^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c1bd5600ad1189fc4e45a1bf36d20e1ab9cfc02;p=thirdparty%2Fknot-resolver.git lib/cache: handle posix_fallocate returning EOPNOTSUPP (Linux/musl) https://man7.org/linux/man-pages/man3/posix_fallocate.3.html#ERRORS: > EOPNOTSUPP > The filesystem containing the file referred to by fd does not support > this operation. This error code can be returned by C libraries that > don't perform the emulation shown in NOTES, such as **musl libc**. I've encountered this problem on Alpine Linux running inside an LXC container on Ubuntu with data on ZFS. --- diff --git a/lib/cache/cdb_lmdb.c b/lib/cache/cdb_lmdb.c index 86ee7aba5..9677c80a5 100644 --- a/lib/cache/cdb_lmdb.c +++ b/lib/cache/cdb_lmdb.c @@ -381,9 +381,10 @@ static int cdb_open_env(struct lmdb_env *env, const char *path, const size_t map } else { ret = 0; } - if (ret == EINVAL) { + if (ret == EINVAL || ret == EOPNOTSUPP) { /* POSIX says this can happen when the feature isn't supported by the FS. - * We haven't seen this happen on Linux+glibc but it was reported on FreeBSD.*/ + * We haven't seen this happen on Linux+glibc but it was reported on + * Linux+musl and FreeBSD. */ kr_log_info(CACHE, "space pre-allocation failed and ignored; " "your (file)system probably doesn't support it.\n"); } else if (ret != 0) {