| --- |
| kernel/printk.c | 22 ++++++++++++++++++---- |
| 1 file changed, 18 insertions(+), 4 deletions(-) |
| |
| --- a/kernel/printk.c |
| +++ b/kernel/printk.c |
| @@ -1377,10 +1377,24 @@ static void cont_flush(enum log_flags fl |
| if (cont.len == 0) |
| return; |
| |
| - log_store(cont.facility, cont.level, LOG_NOCONS | flags, |
| - cont.ts_nsec, NULL, 0, cont.buf, cont.len); |
| - |
| - cont.flushed = true; |
| + if (cont.cons) { |
| + /* |
| + * If a fragment of this line was directly flushed to the |
| + * console; wait for the console to pick up the rest of the |
| + * line. LOG_NOCONS suppresses a duplicated output. |
| + */ |
| + log_store(cont.facility, cont.level, flags | LOG_NOCONS, |
| + cont.ts_nsec, NULL, 0, cont.buf, cont.len); |
| + cont.flushed = true; |
| + } else { |
| + /* |
| + * If no fragment of this line ever reached the console, |
| + * just submit it to the store and free the buffer. |
| + */ |
| + log_store(cont.facility, cont.level, flags, 0, |
| + NULL, 0, cont.buf, cont.len); |
| + cont.len = 0; |
| + } |
| } |
| |
| static bool cont_add(int facility, int level, const char *text, size_t len) |