summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJaegeuk Kim2017-03-07 22:32:20 +0100
committerJaegeuk Kim2017-03-21 21:52:16 +0100
commit8c1b3c0fb6d633d09507ab2dbb23d384941a850a (patch)
tree1af5a69dfe1d90be2d8885a633f7686d7067aa49 /fs
parentf2fs: le32_to_cpu for ckpt->cp_pack_total_block_count (diff)
downloadkernel-qcow2-linux-8c1b3c0fb6d633d09507ab2dbb23d384941a850a.tar.gz
kernel-qcow2-linux-8c1b3c0fb6d633d09507ab2dbb23d384941a850a.tar.xz
kernel-qcow2-linux-8c1b3c0fb6d633d09507ab2dbb23d384941a850a.zip
f2fs: fix wrong error injection for evict_inode
The previous one was not a proper location to inject an error, since there is no point to get errors. Instead, we can emulate EIO during truncation, and the below logic should handle it correctly. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/inode.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index ef8610bf950f..2520fa72b23f 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -372,13 +372,6 @@ void f2fs_evict_inode(struct inode *inode)
if (inode->i_nlink || is_bad_inode(inode))
goto no_delete;
-#ifdef CONFIG_F2FS_FAULT_INJECTION
- if (time_to_inject(sbi, FAULT_EVICT_INODE)) {
- f2fs_show_injection_info(FAULT_EVICT_INODE);
- goto no_delete;
- }
-#endif
-
remove_ino_entry(sbi, inode->i_ino, APPEND_INO);
remove_ino_entry(sbi, inode->i_ino, UPDATE_INO);
@@ -389,6 +382,12 @@ retry:
if (F2FS_HAS_BLOCKS(inode))
err = f2fs_truncate(inode);
+#ifdef CONFIG_F2FS_FAULT_INJECTION
+ if (time_to_inject(sbi, FAULT_EVICT_INODE)) {
+ f2fs_show_injection_info(FAULT_EVICT_INODE);
+ err = -EIO;
+ }
+#endif
if (!err) {
f2fs_lock_op(sbi);
err = remove_inode_page(inode);