early-log: Print warnings only if the buffer is full

Submitted by Dmitry Safonov on Sept. 30, 2019, 11:29 p.m.

Details

Message ID 20190930232914.422608-1-dima@arista.com
State Accepted
Series "early-log: Print warnings only if the buffer is full"
Commit a0dbc1e04e6a0e4f42836f4084a846ab89926dc6
Headers show

Commit Message

Dmitry Safonov Sept. 30, 2019, 11:29 p.m.
I don't see many issues with early-log, so we probably don't
need the warning when it was used. Note that after
commit 74731d9 ("zdtm: make grep_errors also grep warnings")
also warnings are grepped by zdtm.py (and I believe that was
an improvement) which prints some bothering lines:

> =[log]=> dump/zdtm/static/inotify00/38/1/dump.log
> ------------------------ grep Error ------------------------
> (00.000000) Will allow link remaps on FS
> (00.000034) Warn  (criu/log.c:203): The early log isn't empty
> ------------------------ ERROR OVER ------------------------

Instead of decreasing loglevel of the message, improve it by
reporting a real issue.

Cc: Adrian Reber <adrian@lisas.de>
Cc: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Cc: Radostin Stoyanov <rstoyanov1@gmail.com>
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 criu/log.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/log.c b/criu/log.c
index 8bdf83534143..0ee113b91ac2 100644
--- a/criu/log.c
+++ b/criu/log.c
@@ -199,8 +199,8 @@  void flush_early_log_buffer(int fd)
 		}
 		pos += hdr->len;
 	}
-	if (early_log_buf_off)
-		pr_warn("The early log isn't empty\n");
+	if (early_log_buf_off == EARLY_LOG_BUF_LEN)
+		pr_warn("The early log buffer is full, some messages may have been lost\n");
 	early_log_buf_off = 0;
 }
 

Comments

Radostin Stoyanov Oct. 1, 2019, 5:41 a.m.
On 01/10/2019 00:29, Dmitry Safonov wrote:
> I don't see many issues with early-log, so we probably don't
> need the warning when it was used. Note that after
> commit 74731d9 ("zdtm: make grep_errors also grep warnings")
> also warnings are grepped by zdtm.py (and I believe that was
> an improvement) which prints some bothering lines:
>
>> =[log]=> dump/zdtm/static/inotify00/38/1/dump.log
>> ------------------------ grep Error ------------------------
>> (00.000000) Will allow link remaps on FS
>> (00.000034) Warn  (criu/log.c:203): The early log isn't empty
>> ------------------------ ERROR OVER ------------------------
> Instead of decreasing loglevel of the message, improve it by
> reporting a real issue.
>
> Cc: Adrian Reber <adrian@lisas.de>
> Cc: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
> Cc: Radostin Stoyanov <rstoyanov1@gmail.com>
> Signed-off-by: Dmitry Safonov <dima@arista.com>
> ---
>   criu/log.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/criu/log.c b/criu/log.c
> index 8bdf83534143..0ee113b91ac2 100644
> --- a/criu/log.c
> +++ b/criu/log.c
> @@ -199,8 +199,8 @@ void flush_early_log_buffer(int fd)
>   		}
>   		pos += hdr->len;
>   	}
> -	if (early_log_buf_off)
> -		pr_warn("The early log isn't empty\n");
> +	if (early_log_buf_off == EARLY_LOG_BUF_LEN)
> +		pr_warn("The early log buffer is full, some messages may have been lost\n");
>   	early_log_buf_off = 0;
>   }
>   

Thanks!

Reviewed-by: Radostin Stoyanov <rstoyanov1@gmail.com>
Cyrill Gorcunov Oct. 1, 2019, 6:51 a.m.
On Tue, Oct 01, 2019 at 12:29:14AM +0100, Dmitry Safonov wrote:
> I don't see many issues with early-log, so we probably don't
> need the warning when it was used. Note that after
> commit 74731d9 ("zdtm: make grep_errors also grep warnings")
> also warnings are grepped by zdtm.py (and I believe that was
> an improvement) which prints some bothering lines:
> 
> > =[log]=> dump/zdtm/static/inotify00/38/1/dump.log
> > ------------------------ grep Error ------------------------
> > (00.000000) Will allow link remaps on FS
> > (00.000034) Warn  (criu/log.c:203): The early log isn't empty
> > ------------------------ ERROR OVER ------------------------
> 
> Instead of decreasing loglevel of the message, improve it by
> reporting a real issue.
> 
> Cc: Adrian Reber <adrian@lisas.de>
> Cc: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
> Cc: Radostin Stoyanov <rstoyanov1@gmail.com>
> Signed-off-by: Dmitry Safonov <dima@arista.com>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pavel Tikhomirov Oct. 1, 2019, 7:27 a.m.
Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>

On 10/1/19 2:29 AM, Dmitry Safonov wrote:
> I don't see many issues with early-log, so we probably don't
> need the warning when it was used. Note that after
> commit 74731d9 ("zdtm: make grep_errors also grep warnings")
> also warnings are grepped by zdtm.py (and I believe that was
> an improvement) which prints some bothering lines:
> 
>> =[log]=> dump/zdtm/static/inotify00/38/1/dump.log
>> ------------------------ grep Error ------------------------
>> (00.000000) Will allow link remaps on FS
>> (00.000034) Warn  (criu/log.c:203): The early log isn't empty
>> ------------------------ ERROR OVER ------------------------
> 
> Instead of decreasing loglevel of the message, improve it by
> reporting a real issue.
> 
> Cc: Adrian Reber <adrian@lisas.de>
> Cc: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
> Cc: Radostin Stoyanov <rstoyanov1@gmail.com>
> Signed-off-by: Dmitry Safonov <dima@arista.com>
> ---
>   criu/log.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/criu/log.c b/criu/log.c
> index 8bdf83534143..0ee113b91ac2 100644
> --- a/criu/log.c
> +++ b/criu/log.c
> @@ -199,8 +199,8 @@ void flush_early_log_buffer(int fd)
>   		}
>   		pos += hdr->len;
>   	}
> -	if (early_log_buf_off)
> -		pr_warn("The early log isn't empty\n");
> +	if (early_log_buf_off == EARLY_LOG_BUF_LEN)
> +		pr_warn("The early log buffer is full, some messages may have been lost\n");
>   	early_log_buf_off = 0;
>   }
>   
>