linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] f2fs: fix wrong error injection for evict_inode
@ 2017-03-07 22:13 Jaegeuk Kim
  2017-03-07 22:13 ` [PATCH 2/4] f2fs: build stat_info before orphan inode recovery Jaegeuk Kim
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Jaegeuk Kim @ 2017-03-07 22:13 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim

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>
---
 fs/f2fs/inode.c | 13 ++++++-------
 1 file 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 @@ void f2fs_evict_inode(struct inode *inode)
 	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);
-- 
2.11.0


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-03-09 23:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-07 22:13 [PATCH 1/4] f2fs: fix wrong error injection for evict_inode Jaegeuk Kim
2017-03-07 22:13 ` [PATCH 2/4] f2fs: build stat_info before orphan inode recovery Jaegeuk Kim
2017-03-09  9:11   ` Chao Yu
2017-03-09 23:41     ` Jaegeuk Kim
2017-03-09 23:21   ` [PATCH 2/4 v2] " Jaegeuk Kim
2017-03-07 22:13 ` [PATCH 3/4] f2fs: show more precise message on orphan recovery failure Jaegeuk Kim
2017-03-07 22:13 ` [PATCH 4/4] f2fs: use __set{__claer}_bit_le Jaegeuk Kim
2017-03-09 10:38   ` Chao Yu
2017-03-09  8:53 ` [f2fs-dev] [PATCH 1/4] f2fs: fix wrong error injection for evict_inode Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).