]> 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)
commit632d954719dbe1eeb38db62cdaef183ec1ce7fe6
treebec5bed13a74539d2741334593cdd7f2fc4241c5
parent95e6f7b217392e1124b212a90d5f451780eb68c2
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
8e17c22a8e24fbed10941629a37e777ecb275aaf ("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 966b51e63dfe7fa79b34e23a0b3db6dcda1879a5 ("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