aboutsummaryrefslogtreecommitdiff
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2017-03-09 15:24:24 -0800
committerMoyster <oysterized@gmail.com>2017-05-21 18:38:06 +0200
commitbb0acf1c4c729f0460da78eef15d25cd0cf00253 (patch)
treea37ab8ec404e7dc36c771c173cc057e6afa0c7e1 /fs/f2fs/file.c
parentb888bbe3d6c1ab7a77d03fe7e899730fd31e2ecc (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 c5dbe9ff8..29f39b6b4 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -640,6 +640,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);