xfs_logprint: Get xfstests/xfs/295 passing w/ CRCs
cover xfs_logprint: Get xfstests/xfs/295 passing w/ CRCs
None of this really has to do w/ CRCs specificall, but it perturbed the log in a way that exposed a couple o' bugs.
Patches follow.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/2 xfs_logprint: Don't error out after split items lose context
xfs_logprint recognizes a "left over region from split log item" but then expects the *next* op to be a valid start to a new item. The problem is, we can split i.e. an xfs_inode_log_format item, skip over it, and then land on the xfs_icdinode_t data which follows it - this doesn't have a valid log item magic (XFS_LI_*) and we error out. This results in something like:
xfs_logprint: unknown log operation type (494e)
Fix this by recognizing that we've skipped over an item and lost the context we're in, so just continue skipping over op headers until we find the next valid start to a log item.
---
logprint/log_misc.c +6 -2
@@ -874,7 +874,7 @@ xlog_print_record( int bad_hdr_warn) {xfs_caddr_t buf, ptr; -int read_len, skip; +int read_len, skip, lost_context =0 ;int ret, n, i, j, k;if (print_no_print)
@@ -995,7 +995,10 @@ xlog_print_record(if (xlog_print_find_tid (be32_to_cpu (op_head->oh_tid), op_head->oh_flags &XLOG_WAS_CONT_TRANS )) {printf (_ ("Left over region from split log item\n" )); +/* Skip this leftover bit */ ptr +=be32_to_cpu (op_head->oh_len); +/* We've lost context; don't complain if next one looks bad too */ + lost_context =1 ;continue ; }
@@ -1050,7 +1053,7 @@ xlog_print_record(break ; }default : { -if (bad_hdr_warn) { +if (bad_hdr_warn && !lost_context) {fprintf (stderr,_ ("%s: unknown log operation type (%x)\n" ), progname, *(unsigned short *)ptr);
@@ -1064,6 +1067,7 @@ xlog_print_record( } skip =0 ; ptr +=be32_to_cpu (op_head->oh_len); + lost_context =0 ; } }/* switch */ }/* else */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 1/2] xfs_logprint: Don't error out after split items lose context
Quoted 8 lines · Eric Sandeen
xfs_logprintrecognizes a "left over region from split log item" but then expects the *next* op to be a valid start to a new item. The problem is, we can split i.e. anxfs_inode_log_formatitem, skip over it, and then land on thexfs_icdinode_tdata which follows it - this doesn't have a valid log item magic (XFS_LI_*) and we error out. This results in something like:
Quoted 7 lines
xfs_logprint: unknown log operation type (494e)Fix this by recognizing that we've skipped over an item and lost the context we're in, so just continue skipping over op headers until we find the next valid start to a log item.
Signed-off-by Eric Sandeen <[email protected]>
Looks good - fixes the problem and does a good job of explaining it. :)
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/2 xfs_logprint: don't advance op counter in xlog_print_trans_icreate
In reply to Eric Sandeenxlog_print_trans_icreate is advancing the op counter "(*i)++" incorrectly; it only contains one region, and the loop which called it will properly advance the op once we're done.
---
logprint/log_misc.c +0 -1
@@ -810,7 +810,6 @@ xlog_print_trans_icreate(memmove (&icl_buf, *ptr,MIN (sizeof (struct xfs_icreate_log ), len)); icl = &icl_buf; - (*i)++; *ptr += len;/* handle complete header only */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/2] xfs_logprint: don't advance op counter in xlog_print_trans_icreate
Quoted 14 lines · Eric Sandeen
xlog_print_trans_icreateis advancing the op counter "(*i)++" incorrectly; it only contains one region, and the loop which called it will properly advance the op once we're done.Found-by Dave Chinner <[email protected]>Signed-off-by Eric Sandeen <[email protected]>---
logprint/log_misc.c +0
-0
logprint/log_misc.c xlog_print_trans_icreate( · line 815
Quoted 7 lines
logprint/log_misc.c +0
-1@@ -810,7 +810,6 @@ xlog_print_trans_icreate(memmove (&icl_buf, *ptr,MIN (sizeof (struct xfs_icreate_log ), len)); icl = &icl_buf; - (*i)++; *ptr += len;/* handle complete header only */
*nod*. I'm pretty sure I introduced that bug - thanks for exposing it and fixing it :)
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs