diff options
author | Chao Yu <chao@kernel.org> | 2021-12-12 17:17:51 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2022-01-04 13:20:56 -0800 |
commit | 3e0203893e0dc4f64e7dc65ff5ac70e970019827 (patch) | |
tree | 4a2ffb3614721d32d3aa0c199d57989b1109bb16 /fs/f2fs/f2fs.h | |
parent | dd9d4a3a30d009c77139d0cab0f2d08b30fa3941 (diff) | |
download | linux-3e0203893e0dc4f64e7dc65ff5ac70e970019827.tar.gz linux-3e0203893e0dc4f64e7dc65ff5ac70e970019827.tar.bz2 linux-3e0203893e0dc4f64e7dc65ff5ac70e970019827.zip |
f2fs: support fault injection to f2fs_trylock_op()
f2fs: support fault injection for f2fs_trylock_op()
This patch supports to inject fault into f2fs_trylock_op().
Usage:
a) echo 65536 > /sys/fs/f2fs/<dev>/inject_type or
b) mount -o fault_type=65536 <dev> <mountpoint>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r-- | fs/f2fs/f2fs.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index a9ed2fd3fffb..8601d5e979d4 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -56,6 +56,7 @@ enum { FAULT_WRITE_IO, FAULT_SLAB_ALLOC, FAULT_DQUOT_INIT, + FAULT_LOCK_OP, FAULT_MAX, }; @@ -2095,6 +2096,10 @@ static inline void f2fs_lock_op(struct f2fs_sb_info *sbi) static inline int f2fs_trylock_op(struct f2fs_sb_info *sbi) { + if (time_to_inject(sbi, FAULT_LOCK_OP)) { + f2fs_show_injection_info(sbi, FAULT_LOCK_OP); + return 0; + } return down_read_trylock(&sbi->cp_rwsem); } |