mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-06 13:56:40 +00:00
pstore: Alert on backend write error
The pstore dump function doesn't alert at all on errors - despite pstore is usually a last resource and if it fails users won't be able to read the kernel log, this is not the case for server users with serial access, for example. So, let's at least attempt to inform such advanced users on the first backend writing error detected during the kmsg dump - this is also very useful for pstore debugging purposes. Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20221013210648.137452-2-gpiccoli@igalia.com
This commit is contained in:
parent
7d7eca411f
commit
38b91847c3
@ -393,6 +393,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
|
||||
const char *why;
|
||||
unsigned int part = 1;
|
||||
unsigned long flags = 0;
|
||||
int saved_ret = 0;
|
||||
int ret;
|
||||
|
||||
why = kmsg_dump_reason_str(reason);
|
||||
@ -463,12 +464,21 @@ static void pstore_dump(struct kmsg_dumper *dumper,
|
||||
if (ret == 0 && reason == KMSG_DUMP_OOPS) {
|
||||
pstore_new_entry = 1;
|
||||
pstore_timer_kick();
|
||||
} else {
|
||||
/* Preserve only the first non-zero returned value. */
|
||||
if (!saved_ret)
|
||||
saved_ret = ret;
|
||||
}
|
||||
|
||||
total += record.size;
|
||||
part++;
|
||||
}
|
||||
spin_unlock_irqrestore(&psinfo->buf_lock, flags);
|
||||
|
||||
if (saved_ret) {
|
||||
pr_err_once("backend (%s) writing error (%d)\n", psinfo->name,
|
||||
saved_ret);
|
||||
}
|
||||
}
|
||||
|
||||
static struct kmsg_dumper pstore_dumper = {
|
||||
|
Loading…
Reference in New Issue
Block a user