From patchwork Thu May 5 02:59:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 9019911 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8CBDB9F30C for ; Thu, 5 May 2016 02:59:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8880B203DA for ; Thu, 5 May 2016 02:59:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7963E2038D for ; Thu, 5 May 2016 02:59:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755202AbcEEC7U (ORCPT ); Wed, 4 May 2016 22:59:20 -0400 Received: from mail.kernel.org ([198.145.29.136]:34988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754799AbcEEC7T (ORCPT ); Wed, 4 May 2016 22:59:19 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A321203C0; Thu, 5 May 2016 02:59:17 +0000 (UTC) Received: from localhost (107-1-141-74-ip-static.hfc.comcastbusiness.net [107.1.141.74]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A0F122038D; Thu, 5 May 2016 02:59:16 +0000 (UTC) Date: Wed, 4 May 2016 19:59:15 -0700 From: Jaegeuk Kim To: Hou Pengyang Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, wangbintian 00221568 Subject: Re: [f2fs-dev] [PATCH 11/11] f2fs: retry to truncate blocks in -ENOMEM case Message-ID: <20160505025915.GA72618@jaegeuk.gateway> References: <1462299708-67906-1-git-send-email-jaegeuk@kernel.org> <1462299708-67906-11-git-send-email-jaegeuk@kernel.org> <572AA92F.8090802@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <572AA92F.8090802@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, On Thu, May 05, 2016 at 10:00:15AM +0800, Hou Pengyang wrote: > On 2016/5/4 2:21, Jaegeuk Kim wrote: > >This patch modifies to retry truncating node blocks in -ENOMEM case. > > > Hi, Kim. in this patch, I think there is NO chance to retry for -ENOMEM. > > This is because if exist_written_data returns false, we can confirm that > this inode has been released from orphan radix-tree: > f2fs_evict_inode > ---> remove_inode_page > ---> truncate_node > ---> remove_orphan_inode > On this condition, err is 0, So it won't enter: > if (err && err != -ENOENT) > { > ... > } > sequentially, there is no chance to truncate node blocks again. > I miss something else? When I initially tested fault injection, I could hit that before. But, now I can't hit this again. :( It seems it was gone while I updated the error flow before. Agreed with you, and let me take your change. BTW, I even suspect whether this leaking condition happens or not. If f2fs_evict_inode deals with inode deletion, that inode should be an orphan one. So, we don't need to consider that condition actually. So, I wrote this patch as well. I started stress tests again. :) Thanks, From 8c1e4e5ca23410b8f55bbc75d64f75416d486739 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Wed, 4 May 2016 19:48:53 -0700 Subject: [PATCH] f2fs: don't worry about inode leak in evict_inode Even if an inode failed to release its blocks, it should be kept in an orphan inode list, so it will be released later. Signed-off-by: Jaegeuk Kim --- fs/f2fs/inode.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index baf3a2a..689d691 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -377,20 +377,8 @@ no_delete: alloc_nid_failed(sbi, inode->i_ino); clear_inode_flag(fi, FI_FREE_NID); } - - if (err && err != -ENOENT) { - if (!exist_written_data(sbi, inode->i_ino, ORPHAN_INO)) { - /* - * get here because we failed to release resource - * of inode previously, reminder our user to run fsck - * for fixing. - */ - set_sbi_flag(sbi, SBI_NEED_FSCK); - f2fs_msg(sbi->sb, KERN_WARNING, - "inode (ino:%lu) resource leak, run fsck " - "to fix this issue!", inode->i_ino); - } - } + f2fs_bug_on(sbi, err && + !exist_written_data(sbi, inode->i_ino, ORPHAN_INO)); out_clear: fscrypt_put_encryption_info(inode, NULL); clear_inode(inode);