linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] e2fsck: delay metadata checksum in pass1
@ 2012-06-29  2:35 Zheng Liu
  2012-07-31 19:50 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Zheng Liu @ 2012-06-29  2:35 UTC (permalink / raw)
  To: linux-ext4; +Cc: Darrick J. Wong, Theodore Ts'o, Zheng Liu

From: Zheng Liu <wenqing.lz@taobao.com>

in __ext4_get_inode_loc, when all other inodes are free, we will skip I/O.
Thus, all of inodes in this block are set to 0.  Then when we scan these inodes
in pass1, we will get a metadata checksum error.  However, we don't need to scan
these inodes because they have been freed.

This bug can be reproduced by xfstests #013.

Reported-by: Tao Ma <boyu.tm@taobao.com>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
 e2fsck/pass1.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 48a1af0..72f8e82 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -583,6 +583,7 @@ void e2fsck_pass1(e2fsck_t ctx)
 	ext2_ino_t	ino = 0;
 	struct ext2_inode *inode;
 	ext2_inode_scan	scan;
+	errcode_t	csum_errcode;
 	char		*block_buf;
 #ifdef RESOURCE_TRACK
 	struct resource_track	rtrack;
@@ -788,12 +789,7 @@ void e2fsck_pass1(e2fsck_t ctx)
 		pctx.inode = inode;
 		ctx->stashed_ino = ino;
 
-		/* Clear corrupt inode? */
-		if (pctx.errcode == EXT2_ET_INODE_CSUM_INVALID) {
-			if (fix_problem(ctx, PR_1_INODE_CSUM_INVALID, &pctx))
-				goto clear_inode;
-			failed_csum = 1;
-		}
+		csum_errcode = pctx.errcode;
 
 		if (inode->i_links_count) {
 			pctx.errcode = ext2fs_icount_store(ctx->inode_link_info,
@@ -1063,6 +1059,14 @@ void e2fsck_pass1(e2fsck_t ctx)
 			}
 			continue;
 		}
+
+		/* Clear corrupt inode? */
+		if (csum_errcode == EXT2_ET_INODE_CSUM_INVALID) {
+			if (fix_problem(ctx, PR_1_INODE_CSUM_INVALID, &pctx))
+				goto clear_inode;
+			failed_csum = 1;
+		}
+
 		/*
 		 * n.b.  0.3c ext2fs code didn't clear i_links_count for
 		 * deleted files.  Oops.
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-31 19:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-29  2:35 [PATCH] e2fsck: delay metadata checksum in pass1 Zheng Liu
2012-07-31 19:50 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).