mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-26 21:55:44 +07:00
journal: immediately rotate when the journal was previously not closed properly
This commit is contained in:
parent
dca6219e04
commit
71fa6f006f
@ -188,13 +188,15 @@ static int journal_file_verify_header(JournalFile *f) {
|
|||||||
|
|
||||||
state = f->header->state;
|
state = f->header->state;
|
||||||
|
|
||||||
if (state == STATE_ONLINE)
|
if (state == STATE_ONLINE) {
|
||||||
log_debug("Journal file %s is already online. Assuming unclean closing. Ignoring.", f->path);
|
log_debug("Journal file %s is already online. Assuming unclean closing.", f->path);
|
||||||
/* FIXME: immediately rotate */
|
return -EBUSY;
|
||||||
else if (state == STATE_ARCHIVED)
|
} else if (state == STATE_ARCHIVED)
|
||||||
return -ESHUTDOWN;
|
return -ESHUTDOWN;
|
||||||
else if (state != STATE_OFFLINE)
|
else if (state != STATE_OFFLINE) {
|
||||||
log_debug("Journal file %s has unknown state %u. Ignoring.", f->path, state);
|
log_debug("Journal file %s has unknown state %u.", f->path, state);
|
||||||
|
return -EBUSY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -493,7 +493,9 @@ static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, unsigned
|
|||||||
r != -EBADMSG && /* corrupted */
|
r != -EBADMSG && /* corrupted */
|
||||||
r != -ENODATA && /* truncated */
|
r != -ENODATA && /* truncated */
|
||||||
r != -EHOSTDOWN && /* other machine */
|
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));
|
log_error("Failed to write entry, ignoring: %s", strerror(-r));
|
||||||
return;
|
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.");
|
log_info("Allocation limit reached, rotating.");
|
||||||
else if (r == -EHOSTDOWN)
|
else if (r == -EHOSTDOWN)
|
||||||
log_info("Journal file from other machine, rotating.");
|
log_info("Journal file from other machine, rotating.");
|
||||||
|
else if (r == -EBUSY)
|
||||||
|
log_info("Unlcean shutdown, rotating.");
|
||||||
else
|
else
|
||||||
log_warning("Journal file corrupted, rotating.");
|
log_warning("Journal file corrupted, rotating.");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user