Commit def97da1 authored by John Ogness's avatar John Ogness Committed by Petr Mladek

printk: fix exclusive_console replaying

Commit f92b070f ("printk: Do not miss new messages when replaying
the log") introduced a new variable @exclusive_console_stop_seq to
store when an exclusive console should stop printing. It should be
set to the @console_seq value at registration. However, @console_seq
is previously set to @syslog_seq so that the exclusive console knows
where to begin. This results in the exclusive console immediately
reactivating all the other consoles and thus repeating the messages
for those consoles.

Set @console_seq after @exclusive_console_stop_seq has stored the
current @console_seq value.

Fixes: f92b070f ("printk: Do not miss new messages when replaying the log")
Link: http://lkml.kernel.org/r/20191219115322.31160-1-john.ogness@linutronix.de
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarJohn Ogness <john.ogness@linutronix.de>
Acked-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
parent 184b8f7f
...@@ -2770,8 +2770,6 @@ void register_console(struct console *newcon) ...@@ -2770,8 +2770,6 @@ void register_console(struct console *newcon)
* for us. * for us.
*/ */
logbuf_lock_irqsave(flags); logbuf_lock_irqsave(flags);
console_seq = syslog_seq;
console_idx = syslog_idx;
/* /*
* We're about to replay the log buffer. Only do this to the * We're about to replay the log buffer. Only do this to the
* just-registered console to avoid excessive message spam to * just-registered console to avoid excessive message spam to
...@@ -2783,6 +2781,8 @@ void register_console(struct console *newcon) ...@@ -2783,6 +2781,8 @@ void register_console(struct console *newcon)
*/ */
exclusive_console = newcon; exclusive_console = newcon;
exclusive_console_stop_seq = console_seq; exclusive_console_stop_seq = console_seq;
console_seq = syslog_seq;
console_idx = syslog_idx;
logbuf_unlock_irqrestore(flags); logbuf_unlock_irqrestore(flags);
} }
console_unlock(); console_unlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment