[Ocfs2-tools-devel] [PATCH 1/1] fsck.ocfs2: Fail to do normal block check when the file has tree depth > 1. take 2

Tao Ma tao.ma at oracle.com
Wed Jan 16 07:18:41 PST 2008


In 2nd bug fix, it should be "!ret". I removed "!" for the test, but forget to add
it back. Sorry for that. So resend the patch.

For a file which has l_tree_depth > 1, fsck.ocfs2 fail to check it. And even
worse, it writes the wrong value to i_last_eb_blk and return no error. So next
time when the volume is mounted and this file is written, fs will be made
read-only. This is caused by 2 minor bugs.

1. ocfs2_extent_iterate_inode intializes the walk-through extent block buffer
   pointer to a wrong value.
2. We write back the wrong i_last_eb_blk regardless of the return value.

So fix them.

Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
 libocfs2/extents.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libocfs2/extents.c b/libocfs2/extents.c
index d3f998a..654b7e6 100644
--- a/libocfs2/extents.c
+++ b/libocfs2/extents.c
@@ -421,7 +421,7 @@ errcode_t ocfs2_extent_iterate_inode(ocfs2_filesys *fs,
 
 		for (i = 1; i < el->l_tree_depth; i++) {
 			ctxt.eb_bufs[i] = ctxt.eb_bufs[0] +
-				fs->fs_blocksize;
+				i * fs->fs_blocksize;
 		}
 	}
 	else
@@ -450,7 +450,7 @@ errcode_t ocfs2_extent_iterate_inode(ocfs2_filesys *fs,
 	}
 
 out_abort:
-	if (iret & OCFS2_EXTENT_CHANGED)
+	if (!ret && (iret & OCFS2_EXTENT_CHANGED))
 		ret = ocfs2_write_inode(fs, inode->i_blkno, (char *)inode);
 
 out_eb_bufs:
-- 
1.5.3.GIT



More information about the Ocfs2-tools-devel mailing list