From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 02/30] logprint: fix wrapped log dump issue.
Date: Fri, 17 May 2013 21:12:57 +1000 [thread overview]
Message-ID: <1368789205-19969-3-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1368789205-19969-1-git-send-email-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
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@redhat.com>
---
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) {
+ fprintf(stderr,
+ _("%s: unknown log operation type (%x)\n"),
+ progname, *(unsigned short *)ptr);
+ if (print_exit) {
+ free(buf);
+ return BAD_HEADER;
+ }
+ } else {
+ printf(
+ _("Left over region from split log item\n"));
}
skip = 0;
ptr += be32_to_cpu(op_head->oh_len);
@@ -1028,7 +1035,7 @@ xlog_print_record(int fd,
int
-xlog_print_rec_head(xlog_rec_header_t *head, int *len)
+xlog_print_rec_head(xlog_rec_header_t *head, int *len, int bad_hdr_warn)
{
int i;
char uub[64];
@@ -1041,9 +1048,10 @@ xlog_print_rec_head(xlog_rec_header_t *head, int *len)
return ZEROED_LOG;
if (be32_to_cpu(head->h_magicno) != XLOG_HEADER_MAGIC_NUM) {
- printf(_("Header 0x%x wanted 0x%x\n"),
- be32_to_cpu(head->h_magicno),
- XLOG_HEADER_MAGIC_NUM);
+ if (bad_hdr_warn)
+ printf(_("Header 0x%x wanted 0x%x\n"),
+ be32_to_cpu(head->h_magicno),
+ XLOG_HEADER_MAGIC_NUM);
return BAD_HEADER;
}
@@ -1269,8 +1277,9 @@ void xfs_log_print(struct xlog *log,
xfs_daddr_t zeroed_blkno = 0, cleared_blkno = 0;
int read_type = FULL_READ;
xfs_caddr_t partial_buf;
- int zeroed = 0;
- int cleared = 0;
+ int zeroed = 0;
+ int cleared = 0;
+ int first_hdr_found = 0;
logBBsize = log->l_logBBsize;
@@ -1302,7 +1311,7 @@ void xfs_log_print(struct xlog *log,
blkno++;
goto loop;
}
- num_ops = xlog_print_rec_head(hdr, &len);
+ num_ops = xlog_print_rec_head(hdr, &len, first_hdr_found);
blkno++;
if (zeroed && num_ops != ZEROED_LOG) {
@@ -1328,7 +1337,10 @@ void xfs_log_print(struct xlog *log,
cleared_blkno = blkno-1;
cleared++;
} else {
- print_xlog_bad_header(blkno-1, hbuf);
+ if (!first_hdr_found)
+ block_start = blkno;
+ else
+ print_xlog_bad_header(blkno-1, hbuf);
}
goto loop;
@@ -1339,7 +1351,9 @@ void xfs_log_print(struct xlog *log,
break;
}
- error = xlog_print_record(fd, num_ops, len, &read_type, &partial_buf, hdr, xhdrs);
+ error = xlog_print_record(fd, num_ops, len, &read_type, &partial_buf,
+ hdr, xhdrs, first_hdr_found);
+ first_hdr_found++;
switch (error) {
case 0: {
blkno += BTOBB(len);
@@ -1415,7 +1429,7 @@ loop:
blkno++;
goto loop2;
}
- num_ops = xlog_print_rec_head(hdr, &len);
+ num_ops = xlog_print_rec_head(hdr, &len, first_hdr_found);
blkno++;
if (num_ops == ZEROED_LOG ||
@@ -1444,7 +1458,8 @@ partial_log_read:
&read_type,
&partial_buf,
(xlog_rec_header_t *)hbuf,
- xhdrs);
+ xhdrs,
+ first_hdr_found);
if (read_type != FULL_READ)
len -= read_type;
read_type = FULL_READ;
--
1.7.10.4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-05-17 11:13 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-17 11:12 [PATCH 00/30] xfsprogs: Initial CRC support Dave Chinner
2013-05-17 11:12 ` [PATCH 01/30] mkfs: fix realtime device initialisation Dave Chinner
2013-07-22 20:46 ` Ben Myers
2013-05-17 11:12 ` Dave Chinner [this message]
2013-05-17 11:12 ` [PATCH 03/30] libxfs: add crc format changes to generic btrees Dave Chinner
2013-05-17 11:12 ` [PATCH 04/30] xfsprogs: add crc format chagnes to ag headers Dave Chinner
2013-05-17 11:13 ` [PATCH 05/30] xfsprogs: Support new AGFL format Dave Chinner
2013-05-17 11:13 ` [PATCH 06/30] libxfs: change quota buffer formats Dave Chinner
2013-05-17 11:13 ` [PATCH 07/30] libxfs: add version 3 inode support Dave Chinner
2013-05-17 11:13 ` [PATCH 08/30] libxfs: add support for crc headers on remote symlinks Dave Chinner
2013-05-17 11:13 ` [PATCH 09/30] xfs: add CRC checks to block format directory blocks Dave Chinner
2013-05-17 11:13 ` [PATCH 10/30] xfs: add CRC checking to dir2 free blocks Dave Chinner
2013-05-17 11:13 ` [PATCH 11/30] xfs: add CRC checking to dir2 data blocks Dave Chinner
2013-05-17 11:13 ` [PATCH 12/30] xfs: add CRC checking to dir2 leaf blocks Dave Chinner
2013-05-17 11:13 ` [PATCH 13/30] xfs: shortform directory offsets change for dir3 format Dave Chinner
2013-05-17 11:13 ` [PATCH 14/30] xfs: add CRCs to dir2/da node blocks Dave Chinner
2013-05-17 11:13 ` [PATCH 15/30] xfs: add CRCs to attr leaf blocks Dave Chinner
2013-05-17 11:13 ` [PATCH 16/30] xfs: split remote attribute code out Dave Chinner
2013-05-17 11:13 ` [PATCH 17/30] xfs: add CRC protection to remote attributes Dave Chinner
2013-05-17 11:13 ` [PATCH 18/30] xfs: add buffer types to directory and attribute buffers Dave Chinner
2013-05-17 11:13 ` [PATCH 19/30] xfs: buffer type overruns blf_flags field Dave Chinner
2013-05-17 11:13 ` [PATCH 20/30] xfs: add CRC checks to the superblock Dave Chinner
2013-05-17 11:13 ` [PATCH 21/30] xfs: implement extended feature masks Dave Chinner
2013-05-17 11:13 ` [PATCH 22/30] xfsprogs: Add verifiers to libxfs buffer interfaces Dave Chinner
2013-05-17 11:13 ` [PATCH 23/30] patch xfsprogs-mkfs-crc-support-2 Dave Chinner
2013-05-17 11:13 ` [PATCH 24/30] xfsprogs: add crc format support to repair Dave Chinner
2013-05-17 11:13 ` [PATCH 25/30] xfs_repair: update for dir/attr crc format changes Dave Chinner
2013-05-17 11:13 ` [PATCH 26/30] xfsprogs: disable xfs_check for CRC enabled filesystems Dave Chinner
2013-05-17 11:13 ` [PATCH 27/30] xfs_db: disable modification for CRC enabled filessytems Dave Chinner
2013-05-17 11:13 ` [PATCH 28/30] libxfs: determine inode size from version number, not struct xfs_dinode Dave Chinner
2013-05-17 11:13 ` [PATCH 29/30] xfsdb: support version 5 superblock in versionnum command Dave Chinner
2013-05-17 11:13 ` [PATCH 30/30] xfsprogs: add crc format support to db Dave Chinner
2013-05-17 20:54 ` [PATCH 00/30] xfsprogs: Initial CRC support Michael L. Semon
2013-05-18 3:25 ` Dave Chinner
2013-05-18 5:07 ` Jeff Liu
2013-05-18 5:39 ` Dave Chinner
2013-05-18 6:27 ` Michael L. Semon
2013-05-18 8:46 ` Jeff Liu
2013-05-18 5:40 ` Michael L. Semon
2013-05-18 6:27 ` Dave Chinner
2013-05-18 7:42 ` Michael L. Semon
2013-05-18 18:13 ` Michael L. Semon
2013-05-20 6:52 ` [PATCH 0/6] xfsprogs: more CRC support patches Dave Chinner
2013-05-20 6:52 ` [PATCH 1/6] xfs_repair: always use incore header for directory block checks Dave Chinner
2013-05-20 6:52 ` [PATCH 2/6] xfs_db: convert directory parsing to use libxfs structure Dave Chinner
2013-05-20 6:53 ` [PATCH 3/6] xfs_db: factor some common dir2 field parsing code Dave Chinner
2013-05-20 6:53 ` [PATCH 4/6] xfs_db: update field printing for dir crc format changes Dave Chinner
2013-05-20 6:53 ` [PATCH 5/6] xfs_repair: convert directory parsing to use libxfs structure Dave Chinner
2013-05-20 6:53 ` [PATCH 6/6] xfs_repair: make directory freespace table CRC format aware Dave Chinner
2013-05-20 16:11 ` [PATCH 0/6] xfsprogs: more CRC support patches Michael L. Semon
2013-05-23 12:36 ` [PATCH 0/2] xfsprogs: yet " Dave Chinner
2013-05-23 12:36 ` [PATCH 1/2] xfs_db: add CRC information to dquot output Dave Chinner
2013-05-23 12:36 ` [PATCH 2/2] xfs_db: add CRC support for attribute fork structures Dave Chinner
2013-05-27 7:14 ` [PATCH 0/4] xfsprogs: more CRC patches Dave Chinner
2013-05-27 7:14 ` [PATCH 1/4] mkfs.xfs: validate options for CRCs up front Dave Chinner
2013-05-27 7:14 ` [PATCH 2/4] xfsprogs: support CRC enabled filesystem detection Dave Chinner
2013-05-27 7:14 ` [PATCH 3/4] xfs_mdrestore: recalculate sb CRC before writing Dave Chinner
2013-05-27 7:14 ` [PATCH 4/4] xfs_metadump: requires some object CRC recalculation Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1368789205-19969-3-git-send-email-david@fromorbit.com \
--to=david@fromorbit.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox