From: Vladimír Čunát Date: Wed, 4 Mar 2020 12:55:15 +0000 (+0100) Subject: lib/cache: ignore EINVAL from space pre-allocation X-Git-Tag: v5.1.0~37^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c14aacb7d23875057fc6eacd6ecd7bb8e77e0912;p=thirdparty%2Fknot-resolver.git lib/cache: ignore EINVAL from space pre-allocation --- diff --git a/NEWS b/NEWS index 10a89f393..cfd6219c7 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ Knot Resolver 5.x.y (2020-0m-0d) Improvements ------------ - cache garbage collector: reduce filesystem operations when idle (!946) +- cache: missing filesystem support for pre-allocation is no longer fatal (#549) Knot Resolver 5.0.1 (2020-02-05) diff --git a/lib/cache/cdb_lmdb.c b/lib/cache/cdb_lmdb.c index 4c1031293..35292fcbe 100644 --- a/lib/cache/cdb_lmdb.c +++ b/lib/cache/cdb_lmdb.c @@ -333,7 +333,12 @@ static int cdb_open(struct lmdb_env *env, const char *path, size_t mapsize, } ret = posix_fallocate(fd, 0, mapsize); - if (ret != 0) { + if (ret == EINVAL) { + /* 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.*/ + kr_log_info("[cache] space pre-allocation failed and ignored; " + "your (file)system probably doesn't support it.\n"); + } else if (ret != 0) { mdb_txn_abort(txn); stats->close++; mdb_env_close(env->env);