[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 03:50:25 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 unused block, perhaps block 0.

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

diff --git a/fswreck/extent.c b/fswreck/extent.c
index c0550b8..99e3509 100644
--- a/fswreck/extent.c
+++ b/fswreck/extent.c
@@ -171,11 +171,19 @@ static void damage_extent_block(ocfs2_filesys *fs, uint64_t blkno,
 				fprintf(stdout, "EB_GEN: ");
 			else if (type == EB_GEN_FIX)
 				fprintf(stdout, "EB_GEN_FIX: ");
-			else
+			else {
+				oldno = eb->h_list->l_recs[0].e_blkno;
+				eb->h_list->l_recs[0].e_blkno = 0;
 				fprintf(stdout, "EXTENT_EB_INVALID: ");
-			fprintf(stdout, "Corrupt inode#%"PRIu64", change "
-				"generation number from 0x%x to 0x%x\n",
-				blkno, oldno, eb->h_fs_generation);
+			}
+			if (type == EXTENT_EB_INVALID)
+				fprintf(stdout, "Corrupt ino#%"PRIu64", change "
+					"EB record's blkno from 0x%x to 0x%x\n",
+					blkno, oldno, 0);
+			else
+				fprintf(stdout, "Corrupt ino#%"PRIu64", change "
+					"generation number from 0x%x to 0x%x\n",
+					blkno, oldno, eb->h_fs_generation);	
 			break;
 		case EXTENT_LIST_DEPTH: 
 			oldno = eb->h_list.l_tree_depth;
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list