[Crash-utility] [PATCH] Fix for the "log -a" option

Dave Anderson anderson at redhat.com
Thu Feb 13 13:16:37 UTC 2020


What does this patch have to do with "log -a"?

Dave

----- Original Message -----
> From: chenqiwu <chenqiwu at xiaomi.com>
> 
> Fix for the "log -a" option. The printk logbuf is a ring buffer,
> if log_first_idx is larger than log_next_idx, there are two buffer
> zones must be handled for logdump:
> 1) [log_first_idx, log_buf_len]
> 2) [0, log_next_idx]
> 
> However, the original code ignores the logdump for the second buffer
> zone if log_first_idx is larger than log_next_idx. Without this patch,
> the option fails with the following error message "duplicate log_buf
> message pointer".
> 
> Signed-off-by: chenqiwu <chenqiwu at xiaomi.com>
> ---
>  kernel.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel.c b/kernel.c
> index 68ee282..7604fac 100644
> --- a/kernel.c
> +++ b/kernel.c
> @@ -5278,8 +5278,12 @@ dump_variable_length_record_log(int msg_flags)
>  		idx = log_next(idx, logbuf);
>  
>  		if (idx >= log_buf_len) {
> -			error(INFO, "\ninvalid log_buf entry encountered\n");
> -			break;
> +			if (log_first_idx > log_next_idx)
> +				idx = 0;
> +			else {
> +				error(INFO, "\ninvalid log_buf entry encountered\n");
> +				break;
> +			}
>  		}
>  
>  		if (CRASHDEBUG(1) && (idx == log_next_idx))
> --
> 1.9.1
> 
> 




More information about the Crash-utility mailing list