From patchwork Mon May 6 10:33:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13655284 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8524CC25B5F for ; Mon, 6 May 2024 10:33:31 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1s3vf0-0008Mo-Ib; Mon, 06 May 2024 10:33:30 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1s3vez-0008Mg-5r for linux-f2fs-devel@lists.sourceforge.net; Mon, 06 May 2024 10:33:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=f83KS+WRix2D0FSfjaIBor9+kyUWES/deZ9Qxf/EmwE=; b=K4lsRzkIgbvtYS2MEJQe7bhiWa 5LZuK6Lo/xYUJUg1wQxDMd1uKx6dDx2o4TD0GR+kUVD9ynn/0wYWSK+EjhH8T/IOMEwJUDKsOTRmo 1frFSMTkXkpJX+fnXCMOcSVf/vtyR668CG9oUjG5fLVlxwpFVo2l5rCaICjVfatMcjO4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=f83KS+WRix2D0FSfjaIBor9+kyUWES/deZ9Qxf/EmwE=; b=E/R5hFp1BftsKTMkM0ygYcpBCp I9TnvKS//Rb75yqjFIn+GvEhZhZRDPhg7qoOZnZG64EwU2XfbRNkgQ2p93PwMtrs4LVU2YTYweMaX GVX/44fNRonDCKfbCvJWtfcx0WBp7B3QrPG+bmYnkMryNPjd3xbi/WpAmYOJqV7sOjHM=; Received: from sin.source.kernel.org ([145.40.73.55]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1s3vey-00042s-L8 for linux-f2fs-devel@lists.sourceforge.net; Mon, 06 May 2024 10:33:29 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id E533CCE0C68 for ; Mon, 6 May 2024 10:33:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1719C4AF18; Mon, 6 May 2024 10:33:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714991601; bh=8d1H5ohN2OC867yx9Kz7v2nSEmt59J3n2trihH6jcFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YsUNro59jXc0yxJ2XMnh1j9/+xx9X43rLu3WZgQ+WYy1DLyp0VXzPVAyd5JINd7OS mvA2tpZ98mnK26t8zizcnuhFu1QgMA9zoCbmiF6wNmNxlICzZhknuj6R7Pa+uI/EC5 j5UShNpxwcq7gFizl1h1OSlAw1gYAF4FhnGQ2a3YG0ps0INegJv9hwiBKjhnUnY9QG yZlHbyIMcPno4wbhtwShSaksSCOrWPHW/F/CURfu9m5IdvH7MVDceI0baf+6oZTJKy pfqHJagIy1wclYghDINnZLBp/A7E+hRG095sFYt9xnJXO79st8DLBHnk2aBwl7yK2B Jjre/ozJIZDgA== From: Chao Yu To: jaegeuk@kernel.org Date: Mon, 6 May 2024 18:33:12 +0800 Message-Id: <20240506103313.773503-2-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240506103313.773503-1-chao@kernel.org> References: <20240506103313.773503-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1s3vey-00042s-L8 Subject: [f2fs-dev] [PATCH 2/3] f2fs: fix to add missing iput() in gc_data_segment() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net During gc_data_segment(), if inode state is abnormal, it missed to call iput(), fix it. Fixes: 132e3209789c ("f2fs: remove false alarm on iget failure during GC") Fixes: 9056d6489f5a ("f2fs: fix to do sanity check on inode type during garbage collection") Signed-off-by: Chao Yu --- fs/f2fs/gc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 8852814dab7f..e86c7f01539a 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1554,10 +1554,15 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, int err; inode = f2fs_iget(sb, dni.ino); - if (IS_ERR(inode) || is_bad_inode(inode) || - special_file(inode->i_mode)) + if (IS_ERR(inode)) continue; + if (is_bad_inode(inode) || + special_file(inode->i_mode)) { + iput(inode); + continue; + } + err = f2fs_gc_pinned_control(inode, gc_type, segno); if (err == -EAGAIN) { iput(inode);