• Jan Beulich's avatar
    syslog: fill buffer with more than a single message for SYSLOG_ACTION_READ · 116e90b2
    Jan Beulich authored
    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
    b56a39ac ("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 4a77a5a0 ("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: default avatarJan Beulich <jbeulich@suse.com>
    Acked-by: default avatarKay Sievers <kay@vrfy.org>
    Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    116e90b2
printk.c 62.2 KB