[Ocfs2-tools-devel] [PATCH 6/8] Fix inode ECC
Goldwyn Rodrigues
rgoldwyn at gmail.com
Mon Aug 1 10:58:50 PDT 2011
Signed-off-by: Goldwyn Rodrigues <rgoldwyn at suse.de>
---
fsck.ocfs2/fsck.ocfs2.checks.8.in | 9 +++++++++
fsck.ocfs2/pass1.c | 11 +++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/fsck.ocfs2/fsck.ocfs2.checks.8.in
b/fsck.ocfs2/fsck.ocfs2.checks.8.in
index d6289f5..21448e5 100644
--- a/fsck.ocfs2/fsck.ocfs2.checks.8.in
+++ b/fsck.ocfs2/fsck.ocfs2.checks.8.in
@@ -1146,6 +1146,15 @@ the read operation.
Answering yes will recalculate the ECC and write the superblock with the
calculated ECC.
+.SS "INODE_INVALID_ECC"
+The inode has incorrect Error Correcting Code (ECC). ECC is capable of
+correcting corruption upto 1 bit per block. Any corruptions higher that this
+may indicate corruption. In this case the filesystem reports an error with
+the read operation.
+
+Answering yes will recalculate the ECC and write the inode with the
+calculated ECC.
+
.SH "SEE ALSO"
.BR fsck.ocfs2(8)
diff --git a/fsck.ocfs2/pass1.c b/fsck.ocfs2/pass1.c
index 22dafdf..c92a882 100644
--- a/fsck.ocfs2/pass1.c
+++ b/fsck.ocfs2/pass1.c
@@ -441,6 +441,17 @@ static void o2fsck_verify_inode_fields(ocfs2_filesys *fs,
verbosef("checking inode %"PRIu64"'s fields\n", blkno);
+ if (ocfs2_meta_ecc(OCFS2_RAW_SB(ost->ost_fs->fs_super))) {
+ if ((ocfs2_block_check_validate((char *)di, fs->fs_blocksize,
+ &di->i_check) == OCFS2_ET_BAD_ECC) &&
+ prompt(ost, PY, PR_INODE_INVALID_ECC,
+ "Inode %"PRIu64" has invalid ECC."
+ " This means either the ECC is "
+ "incorrect or the inode is corrupt."
+ " Fix ECC?", blkno))
+ o2fsck_write_inode(ost, blkno, di);
+ }
+
if (di->i_fs_generation != ost->ost_fs_generation) {
if (prompt(ost, PY, PR_INODE_GEN,
"Inode read from block %"PRIu64" looks "
--
1.7.6
More information about the Ocfs2-tools-devel
mailing list