summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/journal/journal-file.c14
-rw-r--r--src/journal/journald.c6
2 files changed, 13 insertions, 7 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 9128f0d642..9d8c9e686d 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -188,13 +188,15 @@ static int journal_file_verify_header(JournalFile *f) {
state = f->header->state;
- if (state == STATE_ONLINE)
- log_debug("Journal file %s is already online. Assuming unclean closing. Ignoring.", f->path);
- /* FIXME: immediately rotate */
- else if (state == STATE_ARCHIVED)
+ if (state == STATE_ONLINE) {
+ log_debug("Journal file %s is already online. Assuming unclean closing.", f->path);
+ return -EBUSY;
+ } else if (state == STATE_ARCHIVED)
return -ESHUTDOWN;
- else if (state != STATE_OFFLINE)
- log_debug("Journal file %s has unknown state %u. Ignoring.", f->path, state);
+ else if (state != STATE_OFFLINE) {
+ log_debug("Journal file %s has unknown state %u.", f->path, state);
+ return -EBUSY;
+ }
}
return 0;
diff --git a/src/journal/journald.c b/src/journal/journald.c
index e66bb07f84..8f00aef5bd 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -493,7 +493,9 @@ static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, unsigned
r != -EBADMSG && /* corrupted */
r != -ENODATA && /* truncated */
r != -EHOSTDOWN && /* other machine */
- r != -EPROTONOSUPPORT /* unsupported feature */)) {
+ r != -EPROTONOSUPPORT && /* unsupported feature */
+ r != -EBUSY && /* unclean shutdown */
+ r != -ESHUTDOWN /* already archived */)) {
log_error("Failed to write entry, ignoring: %s", strerror(-r));
return;
}
@@ -502,6 +504,8 @@ static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, unsigned
log_info("Allocation limit reached, rotating.");
else if (r == -EHOSTDOWN)
log_info("Journal file from other machine, rotating.");
+ else if (r == -EBUSY)
+ log_info("Unlcean shutdown, rotating.");
else
log_warning("Journal file corrupted, rotating.");