summaryrefslogtreecommitdiff
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2017-03-09 15:24:24 -0800
committerJaegeuk Kim <jaegeuk@kernel.org>2017-03-21 22:34:26 -0400
commit14b44d238ce7402a99db30b806e08b3e4eddcdbe (patch)
tree36f35e8f60ef21a8452ae6163099c2b3108747b5 /fs/f2fs/file.c
parent1941d7bcb474aa38caca16e6d3416e623d37d800 (diff)
f2fs: add fault injection on f2fs_truncate
Inject a fault during f2fs_truncate(). Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 300d62015c24..af507585c75b 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -620,6 +620,12 @@ int f2fs_truncate(struct inode *inode)
trace_f2fs_truncate(inode);
+#ifdef CONFIG_F2FS_FAULT_INJECTION
+ if (time_to_inject(F2FS_I_SB(inode), FAULT_TRUNCATE)) {
+ f2fs_show_injection_info(FAULT_TRUNCATE);
+ return -EIO;
+ }
+#endif
/* we should check inline_data size */
if (!f2fs_may_inline_data(inode)) {
err = f2fs_convert_inline_inode(inode);