From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754558AbcJKW00 (ORCPT ); Tue, 11 Oct 2016 18:26:26 -0400 Received: from mail.kernel.org ([198.145.29.136]:43694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754410AbcJKW0Z (ORCPT ); Tue, 11 Oct 2016 18:26:25 -0400 Date: Tue, 11 Oct 2016 15:19:03 -0700 From: Jaegeuk Kim To: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu Subject: Re: [PATCH 1/8] f2fs: clear nlink if fail to add_link Message-ID: <20161011221903.GA92615@jaegeuk> References: <20161011145706.5028-1-chao@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161011145706.5028-1-chao@kernel.org> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chao, On Tue, Oct 11, 2016 at 10:56:59PM +0800, Chao Yu wrote: > From: Chao Yu > > 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 > --- > 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); We must call update_inode_page() here to avoid kernel panic. Otherwise, this inode is kept in the gdirty list, resulting in kernel panic when flushg dirty inodes, since it was already evicted. I fixed this and started a round of tests. Thanks, > + > /* don't make bad inode, since it becomes a regular file. */ > unlock_new_inode(inode); > > -- > 2.10.1