[Ocfs2-tools-devel] [PATCH] Memcpy block data before performing metaec blockcheck

Goldwyn Rodrigues rgoldwyn at suse.de
Mon Sep 30 06:55:24 PDT 2013


Code Rearrangement:
We now return OCFS2_ET_BAD_CRC32 when a blockcheck fails. However, we
still copy the data so that the calling function can do what it wants
with the data. This is helpful for fsck.ocfs2 where block can be valid
but crc32 fields are not.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn at suse.com>
---
 libocfs2/inode.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libocfs2/inode.c b/libocfs2/inode.c
index 3e78737..40c0f73 100644
--- a/libocfs2/inode.c
+++ b/libocfs2/inode.c
@@ -297,10 +297,6 @@ errcode_t ocfs2_read_inode(ocfs2_filesys *fs, uint64_t blkno,
 		goto out;
 
 	di = (struct ocfs2_dinode *)blk;
-	ret = ocfs2_validate_meta_ecc(fs, blk, &di->i_check);
-	if (ret)
-		goto out;
-
 	ret = OCFS2_ET_BAD_INODE_MAGIC;
 	if (memcmp(di->i_signature, OCFS2_INODE_SIGNATURE,
 		   strlen(OCFS2_INODE_SIGNATURE)))
@@ -308,6 +304,11 @@ errcode_t ocfs2_read_inode(ocfs2_filesys *fs, uint64_t blkno,
 
 	memcpy(inode_buf, blk, fs->fs_blocksize);
 
+	ret = ocfs2_validate_meta_ecc(fs, blk, &di->i_check);
+	if (ret)
+		goto out;
+
+
 	di = (struct ocfs2_dinode *) inode_buf;
 	ocfs2_swap_inode_to_cpu(fs, di);
 
-- 
1.8.1.4


-- 
Goldwyn



More information about the Ocfs2-tools-devel mailing list