[Ocfs2-tools-devel] [PATCH 11/11] Ocfs2-tools: Fix bug for EXTENT_EB_INVALID corruptor.

Tristan Ye tristan.ye at oracle.com
Mon Jun 8 23:39:52 PDT 2009


The fswreck EXTENT_EB_INVALID corrupter actually does EB_GEN.
But the wrong fsck choice can make this not exercise the EXTENT_EB_INVALID.
The corrupter for EXTENT_EB_INVALID should instead have an extent
record pointing to an invalid block, perhaps block no of inode itself.

Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
 fswreck/extent.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/fswreck/extent.c b/fswreck/extent.c
index c0550b8..49e2ab2 100644
--- a/fswreck/extent.c
+++ b/fswreck/extent.c
@@ -164,7 +164,6 @@ static void damage_extent_block(ocfs2_filesys *fs, uint64_t blkno,
 			break;
 		case EB_GEN:
 		case EB_GEN_FIX:
-		case EXTENT_EB_INVALID:
 			oldno = eb->h_fs_generation;
 			eb->h_fs_generation = 0x1234;
 			if (type == EB_GEN)
@@ -177,6 +176,15 @@ static void damage_extent_block(ocfs2_filesys *fs, uint64_t blkno,
 				"generation number from 0x%x to 0x%x\n",
 				blkno, oldno, eb->h_fs_generation);
 			break;
+		case EXTENT_EB_INVALID:
+			el->l_recs[0].e_blkno = di->i_blkno;
+			fprintf(stdout, "Corrupt ino#%"PRIu64" such that "
+				"it points to an inode (itself) where it "
+				"should be pointing to the extent block at "
+				"%"PRIu64"\n",
+				blkno, eb->h_blkno);
+
+			break;
 		case EXTENT_LIST_DEPTH: 
 			oldno = eb->h_list.l_tree_depth;
 			eb->h_list.l_tree_depth += 1;
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list