Merge pull request #12645 from poettering/journal-mmap-einval

journald: output a proper error message when the journal is used on f…
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-05-23 09:37:54 +02:00 committed by GitHub
commit ed55dc6084
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View 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;

View 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;
}