]> git.baikalelectronics.ru Git - kernel.git/commit
syslog: fill buffer with more than a single message for SYSLOG_ACTION_READ
authorJan Beulich <JBeulich@suse.com>
Fri, 22 Jun 2012 15:36:09 +0000 (16:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Jun 2012 19:37:36 +0000 (12:37 -0700)
commite958aa08af6f62a54c15a20993ce1a05443d8c16
treebec5bed13a74539d2741334593cdd7f2fc4241c5
parentfc3abc78cfd34f86440a02098ea7c197d2645d1b
syslog: fill buffer with more than a single message for SYSLOG_ACTION_READ

The recent changes to the printk buffer management resulted in
SYSLOG_ACTION_READ to only return a single message, whereas previously
the buffer would get filled as much as possible. As, when too small to
fit everything, filling it to the last byte would be pretty ugly with
the new code, the patch arranges for as many messages as possible to
get returned in a single invocation. User space tools in at least all
SLES versions depend on the old behavior.

This at once addresses the issue attempted to get fixed with commit
6fd927967d67ac35ff143ad9334a841bd8997fdf ("printk: return -EINVAL if
the message len is bigger than the buf size"), and since that commit
widened the possibility for losing a message altogether, the patch
here assumes that this other commit would get reverted first
(otherwise the patch here won't apply).

Furthermore, this patch also addresses the problem dealt with in
commit f2c41e66e7ba8732601e75bd4d2e5b3ceaa5979e ("printk: use mutex
lock to stop syslog_seq from going wild"), so I'd recommend reverting
that one too (albeit there's no direct collision between the two).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kay Sievers <kay@vrfy.org>
Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/printk.c