On Thu 2021-02-18 09:18:04, John Ogness wrote: > The second loop of syslog_print_all() subtracts lengths that were > added in the first loop. With commit b031a684bfd0 ("printk: remove > logbuf_lock writer-protection of ringbuffer") it is possible that > records are (over)written during syslog_print_all(). This allows the > possibility of the second loop subtracting lengths that were never > added in the first loop. > > This situation can result in syslog_print_all() filling the buffer > starting from a later record, even though there may have been room > to fit the earlier record(s) as well. > > Fixes: b031a684bfd0 ("printk: remove logbuf_lock writer-protection of > ringbuffer") > Signed-off-by: John Ogness <john.ogn...@linutronix.de>
It makes sense after all. We reach the limit only when many old messages has got replaced. It means that there is a flood of messages. And this limit looks like a reasonable point where to start filling the provided buffer. Reviewed-by: Petr Mladek <pmla...@suse.com> Best Regards, Petr