From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751424AbdH1MiK (ORCPT ); Mon, 28 Aug 2017 08:38:10 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35215 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751269AbdH1MiJ (ORCPT ); Mon, 28 Aug 2017 08:38:09 -0400 Date: Mon, 28 Aug 2017 21:38:26 +0900 From: Sergey Senozhatsky To: Sergey Senozhatsky Cc: Pavel Machek , Sergey Senozhatsky , Petr Mladek , Steven Rostedt , Jan Kara , Andrew Morton , Jiri Slaby , Andreas Mohr , Tetsuo Handa , linux-kernel@vger.kernel.org Subject: Re: printk: what is going on with additional newlines? Message-ID: <20170828123826.GA403@jagdpanzerIV.localdomain> References: <20170815025625.1977-1-sergey.senozhatsky@gmail.com> <20170828090521.GA25025@amd> <20170828102830.GA403@jagdpanzerIV.localdomain> <20170828122109.GA532@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170828122109.GA532@jagdpanzerIV.localdomain> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (08/28/17 21:21), Sergey Senozhatsky wrote: > how about something like this? > ...ok, definetely breaks the KERN_ERR "foo"; KERN_CONT "bar"; KERN_CONT "bar"; KERN_CONT "\n"; case. um... something like this then? --- diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index fc47863f629c..098e280e9fe0 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -1670,10 +1670,11 @@ static size_t log_output(int facility, int level, enum log_flags lflags, const c * write from the same process, try to add it to the buffer. */ if (cont.len) { - if (cont.owner == current && (lflags & LOG_CONT)) { + if (cont.owner == current && + ((cont.level == level) || + (lflags & LOG_CONT))) if (cont_add(facility, level, lflags, text, text_len)) return text_len; - } /* Otherwise, make sure it's flushed */ cont_flush(); }