diff options
author | Chao Yu <chao@kernel.org> | 2022-10-06 17:09:28 +0200 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2022-11-02 01:56:01 +0100 |
commit | 18792e64c86dd7e34ba28e4f61faba472b7bf5fc (patch) | |
tree | cf556062201420aebaa784589c64baa6d3c6c0cf /fs/f2fs/checkpoint.c | |
parent | f2fs: fix to invalidate dcc->f2fs_issue_discard in error path (diff) | |
download | linux-18792e64c86dd7e34ba28e4f61faba472b7bf5fc.tar.xz linux-18792e64c86dd7e34ba28e4f61faba472b7bf5fc.zip |
f2fs: support fault injection for f2fs_is_valid_blkaddr()
This patch supports to inject fault into f2fs_is_valid_blkaddr() to
simulate accessing inconsistent data/meta block addressses from caller.
Usage:
a) echo 262144 > /sys/fs/f2fs/<dev>/inject_type or
b) mount -o fault_type=262144 <dev> <mountpoint>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/checkpoint.c')
-rw-r--r-- | fs/f2fs/checkpoint.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 0c82dae082aa..c00694a50222 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -171,6 +171,11 @@ static bool __is_bitmap_valid(struct f2fs_sb_info *sbi, block_t blkaddr, bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi, block_t blkaddr, int type) { + if (time_to_inject(sbi, FAULT_BLKADDR)) { + f2fs_show_injection_info(sbi, FAULT_BLKADDR); + return false; + } + switch (type) { case META_NAT: break; |