linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] f2fs: clear nlink if fail to add_link
@ 2016-10-11 14:56 Chao Yu
  2016-10-11 14:57 ` [PATCH 2/8] f2fs: fix to release discard entries during checkpoint Chao Yu
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Chao Yu @ 2016-10-11 14:56 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

From: Chao Yu <yuchao0@huawei.com>

We don't need to keep incomplete created inode in cache, so if we fail to
add link into directory during new inode creation, it's better to set
nlink of inode to zero, then we can evict inode immediately. Otherwise
release of nid belong to inode will be delayed until inode cache is being
shrunk, it may cause a seemingly endless loop while allocating free nids
in time of testing generic/269 case of fstest suit.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/inode.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index d736989..34ae03c 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -384,6 +384,8 @@ retry:
 		f2fs_lock_op(sbi);
 		err = remove_inode_page(inode);
 		f2fs_unlock_op(sbi);
+		if (err == -ENOENT)
+			err = 0;
 	}
 
 	/* give more chances, if ENOMEM case */
@@ -424,6 +426,12 @@ void handle_failed_inode(struct inode *inode)
 	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 	struct node_info ni;
 
+	/*
+	 * clear nlink of inode in order to release resource of inode
+	 * immediately.
+	 */
+	clear_nlink(inode);
+
 	/* don't make bad inode, since it becomes a regular file. */
 	unlock_new_inode(inode);
 
-- 
2.10.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

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

end of thread, other threads:[~2016-10-13 10:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-11 14:56 [PATCH 1/8] f2fs: clear nlink if fail to add_link Chao Yu
2016-10-11 14:57 ` [PATCH 2/8] f2fs: fix to release discard entries during checkpoint Chao Yu
2016-10-11 14:57 ` [PATCH 3/8] f2fs: give a chance to detach from dirty list Chao Yu
2016-10-11 14:57 ` [PATCH 4/8] f2fs: add missing f2fs_balance_fs in f2fs_zero_range Chao Yu
2016-10-11 14:57 ` [PATCH 5/8] f2fs: don't miss any f2fs_balance_fs cases Chao Yu
2016-10-11 14:57 ` [PATCH 6/8] f2fs: be aware of extent beyond EOF in fiemap Chao Yu
2016-10-11 14:57 ` [PATCH 7/8] f2fs: fix to update largest extent under lock Chao Yu
2016-10-11 14:57 ` [PATCH 8/8] f2fs: fix error handling in fsync_node_pages Chao Yu
2016-10-11 22:19 ` [PATCH 1/8] f2fs: clear nlink if fail to add_link Jaegeuk Kim
2016-10-12 15:24   ` Chao Yu
2016-10-12 17:22     ` Jaegeuk Kim
2016-10-13 10:29       ` 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).