blob: 3221e16df7ee7205fb0710cfe573a6f7396b3c31 [file]
---
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 we have flushed a fragment of this line to the console,
+ * we need to wait for the console to pick up the full line.
+ * We add a flag to suppress a duplicated output from the store.
+ */
+ log_store(cont.facility, cont.level, flags | LOG_NOCONS,
+ cont.ts_nsec, NULL, 0, cont.buf, cont.len);
+ cont.flushed = true;
+ } else {
+ /*
+ * If we never flushed a fragment of this line to the console,
+ * we can just submit it to the store and free the buffer.
+ */
+ log_store(cont.facility, cont.level, flags, cont.ts_nsec,
+ NULL, 0, cont.buf, cont.len);
+ cont.len = 0;
+ }
}
static bool cont_add(int facility, int level, const char *text, size_t len)