aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-05-23 09:37:54 +0200
committerGitHub <noreply@github.com>2019-05-23 09:37:54 +0200
commited55dc60848e3276e7ea1beec02b9da8d197b10f (patch)
tree06ae415c755b39347fde07e60ca855c6671ea1a1
parentshared/machine-image: avoid passing NULL to log_debug_errno (diff)
parentjournald: output a proper error message when the journal is used on fs that doesn't do mmap() properly (diff)
downloadsystemd-ed55dc60848e3276e7ea1beec02b9da8d197b10f.tar.xz
systemd-ed55dc60848e3276e7ea1beec02b9da8d197b10f.zip
Merge pull request #12645 from poettering/journal-mmap-einval
journald: output a proper error message when the journal is used on f…
-rw-r--r--src/journal/journal-file.c7
-rw-r--r--src/journal/journald-server.c4
2 files changed, 11 insertions, 0 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 3e285021bdc..c38c3e7c14f 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -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;
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 51e7dedad59..414571191f8 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -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;
}