]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/cache: ignore EINVAL from space pre-allocation
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 4 Mar 2020 12:55:15 +0000 (13:55 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 6 Mar 2020 08:03:39 +0000 (09:03 +0100)
NEWS
lib/cache/cdb_lmdb.c

diff --git a/NEWS b/NEWS
index 10a89f3930c519170b633a8470c1024ae0be90be..cfd6219c7bd6fbc23003b0e02bae9299d049387a 100644 (file)
--- 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)
index 4c1031293a56337363f62308fc4fbb605503b517..35292fcbe5f43c5c763c3caf0be832792d52cbe4 100644 (file)
@@ -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);