[Ocfs2-tools-devel] [PATCH 1/2] fswreck: Create a loop in group chains
Goldwyn Rodrigues
rgoldwyn at gmail.com
Fri Sep 21 08:39:10 PDT 2012
I had posted these patches way back in 2010, but they were not included
on efficiency concerns. However, the problem was not fixed at all.
Another customer incident occurred; so I am re-posting them.
Signed-off-by: Goldwyn Rodrigues <rgoldwyn at suse.de>
---
fswreck/corrupt.c | 3 +++
fswreck/group.c | 6 ++++++
fswreck/include/fsck_type.h | 1 +
fswreck/main.c | 2 ++
4 files changed, 12 insertions(+)
diff --git a/fswreck/corrupt.c b/fswreck/corrupt.c
index 533481e..ba59e23 100644
--- a/fswreck/corrupt.c
+++ b/fswreck/corrupt.c
@@ -331,6 +331,9 @@ void corrupt_group_desc(ocfs2_filesys *fs, enum
fsck_type type,
case GROUP_FREE_BITS:
func = mess_up_group_minor;
break;
+ case GROUP_CHAIN_LOOP:
+ func = mess_up_group_minor;
+ break;
case GROUP_GEN:
func = mess_up_group_gen;
break;
diff --git a/fswreck/group.c b/fswreck/group.c
index 48dc7ef..593fe38 100644
--- a/fswreck/group.c
+++ b/fswreck/group.c
@@ -176,6 +176,12 @@ static void damage_group_desc(ocfs2_filesys *fs,
uint64_t blkno,
bg->bg_chain, (bg->bg_chain + 10));
bg->bg_chain += 10;
break;
+ case GROUP_CHAIN_LOOP:
+ fprintf(stdout, "Corrput GROUP_LOOP: "
+ "change group next from %"PRIu64" to %"PRIu64"\n",
+ bg->bg_next_group, cr->c_blkno);
+ bg->bg_next_group = cpu_to_le64(cr->c_blkno);
+ break;
case GROUP_FREE_BITS:
fprintf(stdout, "Corrput GROUP_FREE_BITS: "
"change group free bits from %u to %u\n",
diff --git a/fswreck/include/fsck_type.h b/fswreck/include/fsck_type.h
index 3999647..fc0ee90 100644
--- a/fswreck/include/fsck_type.h
+++ b/fswreck/include/fsck_type.h
@@ -57,6 +57,7 @@ enum fsck_type
GROUP_BLKNO,
GROUP_CHAIN,
GROUP_FREE_BITS,
+ GROUP_CHAIN_LOOP,
CHAIN_COUNT,
CHAIN_NEXT_FREE,
CHAIN_EMPTY,
diff --git a/fswreck/main.c b/fswreck/main.c
index 3164ce0..d64c2fc 100644
--- a/fswreck/main.c
+++ b/fswreck/main.c
@@ -102,6 +102,8 @@ static struct prompt_code prompt_codes[NUM_FSCK_TYPE] = {
"Corrupt chain group's blkno"),
define_prompt_code(GROUP_CHAIN, corrupt_group_desc, "", 1,
"Corrupt chain group's chain where it was in"),
+ define_prompt_code(GROUP_CHAIN_LOOP, corrupt_group_desc, "", 1,
+ "Corrupt group's chain to form a loop"),
define_prompt_code(GROUP_FREE_BITS, corrupt_group_desc, "", 1,
"Corrupt chain group's free bits"),
define_prompt_code(CHAIN_COUNT, corrupt_sys_file, "", 1,
--
1.7.10.4
More information about the Ocfs2-tools-devel
mailing list