xfs
[Top] [All Lists]

Re: [PATCH 02/48] logprint: fix wrapped log dump issue.

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 02/48] logprint: fix wrapped log dump issue.
From: Ben Myers <bpm@xxxxxxx>
Date: Mon, 22 Jul 2013 16:44:49 -0500
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1370564771-4929-3-git-send-email-david@xxxxxxxxxxxxx>
References: <1370564771-4929-1-git-send-email-david@xxxxxxxxxxxxx> <1370564771-4929-3-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.20 (2009-06-14)
On Fri, Jun 07, 2013 at 10:25:25AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> When running xfs/295 on a 512 byte block size filesystem, logprint
> fails during checking with a "Bad log record header" error. This is
> due to the fact that the log has wrapped and there is partial record
> a the start of the log.
> 
> logprint doesn't check for this condition, and simply assumes that
> the first block in the log contains a log header, and hence aborts
> when this case occurs. So we now have a spurious test failure due to
> logprint displaying how right this comment is:
> 
> /*
>  * This code is gross and needs to be rewritten.
>  */
> 
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
> ---
>  logprint/log_misc.c |   49 ++++++++++++++++++++++++++++++++-----------------
>  1 file changed, 32 insertions(+), 17 deletions(-)
> 
> diff --git a/logprint/log_misc.c b/logprint/log_misc.c
> index d08f900..334b6bf 100644
> --- a/logprint/log_misc.c
> +++ b/logprint/log_misc.c
> @@ -833,7 +833,8 @@ xlog_print_record(int                       fd,
>                int                      *read_type,
>                xfs_caddr_t              *partial_buf,
>                xlog_rec_header_t        *rhead,
> -              xlog_rec_ext_header_t    *xhdrs)
> +              xlog_rec_ext_header_t    *xhdrs,
> +              int                      bad_hdr_warn)
>  {
>      xfs_caddr_t              buf, ptr;
>      int                      read_len, skip;
> @@ -1006,11 +1007,17 @@ xlog_print_record(int                   fd,
>                       break;
>                   }
>                   default: {
> -                     fprintf(stderr, _("%s: unknown log operation type 
> (%x)\n"),
> -                             progname, *(unsigned short *)ptr);
> -                     if (print_exit) {
> -                             free(buf);
> -                             return BAD_HEADER;
> +                     if(bad_hdr_warn) {
                          ^ Added a space.

Reviewed-by: Ben Myers <bpm@xxxxxxx>

Applied to the master branch.

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH 02/48] logprint: fix wrapped log dump issue., Ben Myers <=