[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1340937356-12493-1-git-send-email-wenqing.lz@taobao.com>
Date: Fri, 29 Jun 2012 10:35:56 +0800
From: Zheng Liu <gnehzuil.liu@...il.com>
To: linux-ext4@...r.kernel.org
Cc: "Darrick J. Wong" <djwong@...ibm.com>,
"Theodore Ts'o" <tytso@....edu>, Zheng Liu <wenqing.lz@...bao.com>
Subject: [PATCH] e2fsck: delay metadata checksum in pass1
From: Zheng Liu <wenqing.lz@...bao.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@...bao.com>
Cc: Darrick J. Wong <djwong@...ibm.com>
Cc: "Theodore Ts'o" <tytso@....edu>
Signed-off-by: Zheng Liu <wenqing.lz@...bao.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
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists