[Ocfs2-tools-devel] [PATCH 2/2] fswreck: corrupt inode valid flag
Eric Ren
zren at suse.com
Wed Jul 8 20:40:30 PDT 2015
This one is used to corrupt the inode valid flag.
INODE_VALID_FLAG: clear the INODE_VALID_FL bit of i_flags in
ocfs2_dinode.
Signed-off-by: Eric Ren <zren at suse.com>
Reviewed-by: Goldwyn Rodrigues <rgoldwyn at suse.com>
Reviewed-by: Gang He <ghe at suse.com>
---
fswreck/corrupt.c | 3 +++
fswreck/include/fsck_type.h | 3 ++-
fswreck/inode.c | 8 +++++++-
fswreck/main.c | 2 ++
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/fswreck/corrupt.c b/fswreck/corrupt.c
index 7ccb164..2f6074e 100644
--- a/fswreck/corrupt.c
+++ b/fswreck/corrupt.c
@@ -228,6 +228,9 @@ void corrupt_file(ocfs2_filesys *fs, enum fsck_type type, uint16_t slotnum)
case INODE_BLOCK_ECC:
func = mess_up_inode_field;
break;
+ case INODE_VALID_FLAG:
+ func = mess_up_inode_field;
+ break;
default:
FSWRK_FATAL("Invalid code=%d", type);
}
diff --git a/fswreck/include/fsck_type.h b/fswreck/include/fsck_type.h
index b62585e..956a1e2 100644
--- a/fswreck/include/fsck_type.h
+++ b/fswreck/include/fsck_type.h
@@ -167,7 +167,8 @@ enum fsck_type
/*130*/ REFCOUNT_COUNT_INVALID,
DUP_CLUSTERS_ADD_REFCOUNT,
INODE_BLOCK_ECC,
-/*133*/ NUM_FSCK_TYPE
+ INODE_VALID_FLAG,
+/*134*/ NUM_FSCK_TYPE
};
/*
diff --git a/fswreck/inode.c b/fswreck/inode.c
index 674ddbc..83adae2 100644
--- a/fswreck/inode.c
+++ b/fswreck/inode.c
@@ -28,7 +28,7 @@
*
* Inode field error: INODE_SUBALLOC, INODE_GEN, INODE_GEN_FIX,INODE_BLKNO,
INODE_NZ_DTIME, INODE_SIZE, INODE_CLUSTERS, INODE_COUNT,
- INODE_BLOCK_ECC
+ INODE_BLOCK_ECC, INODE_VALID_FLAG
*
* Inode link not connected error: INODE_NOT_CONNECTED
*
@@ -137,6 +137,12 @@ static void damage_inode(ocfs2_filesys *fs, uint64_t blkno,
di->i_check.bc_crc32e = 0x1234;
di->i_check.bc_ecc = 0x1234;
break;
+ case INODE_VALID_FLAG:
+ fprintf(stdout, "INODE_VALID_FLAG: "
+ "Corrupt inode#%"PRIu64", clear inode valid flag\n",
+ blkno);
+ di->i_flags &= ~OCFS2_VALID_FL;
+ break;
case REFCOUNT_FLAG_INVALID:
di->i_dyn_features |= OCFS2_HAS_REFCOUNT_FL;
fprintf(stdout, "REFCOUNT_FLAG_INVALD: "
diff --git a/fswreck/main.c b/fswreck/main.c
index f9227f3..016fc03 100644
--- a/fswreck/main.c
+++ b/fswreck/main.c
@@ -329,6 +329,8 @@ static struct prompt_code prompt_codes[NUM_FSCK_TYPE] = {
"corrupt refcount record and handle them in dup"),
define_prompt_code(INODE_BLOCK_ECC, corrupt_file, "", 1,
"corrupt inode's i_check filed"),
+ define_prompt_code(INODE_VALID_FLAG, corrupt_file, "", 1,
+ "corrupt inode's i_flags filed"),
};
#undef define_prompt_code
--
2.1.2
More information about the Ocfs2-tools-devel
mailing list