]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journald: output a proper error message when the journal is used on fs that doesn... 12645/head
authorLennart Poettering <lennart@poettering.net>
Wed, 22 May 2019 16:48:02 +0000 (18:48 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 22 May 2019 16:56:24 +0000 (18:56 +0200)
Prompted by:

https://lists.freedesktop.org/archives/systemd-devel/2019-May/042708.html

src/journal/journal-file.c
src/journal/journald-server.c

index 3e285021bdc90d47276b6d11e972a3971b07e681..c38c3e7c14f3f04a825d46741bdbb56d6bded63e 100644 (file)
@@ -3323,6 +3323,13 @@ int journal_file_open(
         }
 
         r = mmap_cache_get(f->mmap, f->cache_fd, f->prot, CONTEXT_HEADER, true, 0, PAGE_ALIGN(sizeof(Header)), &f->last_stat, &h, NULL);
+        if (r == -EINVAL) {
+                /* Some file systems (jffs2 or p9fs) don't support mmap() properly (or only read-only
+                 * mmap()), and return EINVAL in that case. Let's propagate that as a more recognizable error
+                 * code. */
+                r = -EAFNOSUPPORT;
+                goto fail;
+        }
         if (r < 0)
                 goto fail;
 
index 51e7dedad59fce3ff992c6cf7d9a0beb3f021b0e..414571191f8729427bec9eb558781be64899a520 100644 (file)
@@ -787,6 +787,10 @@ static bool shall_try_append_again(JournalFile *f, int r) {
                 log_warning("%s: Journal file is from the future, rotating.", f->path);
                 return true;
 
+        case -EAFNOSUPPORT:
+                log_warning("%s: underlying file system does not support memory mapping or another required file system feature.", f->path);
+                return false;
+
         default:
                 return false;
         }