Skip to contentSkip to conversation

xfs_logprint: Get xfstests/xfs/295 passing w/ CRCs

PATCH New Eric Sandeen 3 participants 5 messages Feb 27, 2014

lore
Share & tools
lore
#1 lore raw

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
index cf9d59d..7070fa3 100644
@@ -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

Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] xfs_logprint: Don't error out after split items lose context

Quoted 8 lines · Eric Sandeen

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:

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.

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
#3 lore raw

PATCH 2/2 xfs_logprint: don't advance op counter in xlog_print_trans_icreate

In reply to Eric Sandeen

xlog_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
index 7070fa3..52f1e85 100644
@@ -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

Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] xfs_logprint: don't advance op counter in xlog_print_trans_icreate

Quoted 14 lines · Eric Sandeen

xlog_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 -0
index 7070fa3..52f1e85 100644

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