Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp883834lqo; Wed, 8 May 2024 19:49:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUQoBpFD5S7f2QyNERMOGj4ldbFw0nNnvmlKD2l/CGyslns+jVjwCqoPmVP9qpy7tqK/FLex/41pqcea6rex/u+4Ah1qhpk9FdDeJejkg== X-Google-Smtp-Source: AGHT+IH73CqbCM+aLS4aHN9JTjnaPh1zXcpT1qzPAm6DqwBYx61sEeap3b+4r6Pmsu3lahECnkwb X-Received: by 2002:a05:6102:26ca:b0:47f:2d80:b326 with SMTP id ada2fe7eead31-47f3c372683mr5430456137.29.1715222985810; Wed, 08 May 2024 19:49:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715222985; cv=pass; d=google.com; s=arc-20160816; b=M74xnS6ignyDSfeQ8behGg7dHrEm0ML8M3nB2axXBeL0mwGai7sFD6v4UNMFaQGKRe t8XlH2F8Ch4M3ggdQbgVIWBs9cq0PfjVrq8WU+XT2wmIZyk4wqTPc05Uy1Qe6jfxKZZI YyYuV35vCPn0EnnZmA/FJl5S5WA3DdKJV9mfIJFiFrLfC97U9zyxsBin8Xc53mzHruFd G2CoVinzf857W6DM9FOWlpmgxPU0x6ZtCLcSdYKa4ql/uMk9YRpojZ9tfTes/u+pRgxq HLq0G714a5pVeqTfOqK8YXUEqGnk+6IzDmLZYEIxnPzZy4hOT4LecJxKeytwBxxIx6uX lgQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=eQ2ZfuN6ESR9O9jmWDY6Q3tDkOgJPSto4ss51kU4ngs=; fh=1D7eQ/0rc+iU6BAcs/KVKWP4G7WgjJ9VzUdfNwtKJ+I=; b=j1UoUxoUwxJF1EgBszOhbfIgeNWzA2/g0gaK+GBRHRm9Oay4D2q02q5VgrY4OHCIQ2 pEPL9YFEDgcjJ4Z+UoyqAolPtfxfsz6o0YDsIRoUQ+tGMn6S/9FtDc7XUvDE92G/SQyY D2ynh+keFhCmiC1RnGS/oyNq0sXVRpHDCpHhxPgFFVuhPx72pCAJGludPw+wRE/JtmfJ 4xxuYrw22WrPbBMBFGiVE5k8QAPbBbyLN4onNN0FFVvximQCLV1mYhgEVnm2R4IWbRLZ 2vynWTA365D/+BbRdx/uH81TiUeIS1+Zg1N+PPuzqIL4uk1dlHmfB0zzWoPSD1nC7n3W +DaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JOTE8orV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-174069-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174069-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f1feacbsi4883046d6.142.2024.05.08.19.49.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 19:49:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174069-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JOTE8orV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-174069-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174069-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3054F1C217E2 for ; Thu, 9 May 2024 02:49:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 93FEA13BC25; Thu, 9 May 2024 02:49:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JOTE8orV" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC92B13A87A for ; Thu, 9 May 2024 02:49:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715222961; cv=none; b=jDI/7pwl0O9hn9fL7mndPJClNZ8RaWQEZY2mu+nPhzs9SropKJhT4dLXYdLIew9ATwKiHXHivi9TBTXBfqpeyF0ZbAcL/w3cipW+mcyHiNABedhMed2E/JDshBDvgSk95f+4u5jY7867MEAvQ7GfFBtdBMhDY0oIrSwRlDKbTRg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715222961; c=relaxed/simple; bh=v7wln2xpQLVVAxH/uG3eYmTTj+iPQmXfVO6dtLtvARw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=fRnf7Hg6bqRyCdjT4+3zIRne+n625PDM3nDmylX4QFQO+B9rmarwGSuAhWrVrH9CxPUZ+L589va3TWuRKtoa1mhRmz9+hSL+mr1/Szv7KeUpul6G4eeIu2lJuo6/TRtqAqH/C63YMDYUs1FY6DF5x00/5acjk3y5pT3XyJu7KAI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JOTE8orV; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49456C113CC; Thu, 9 May 2024 02:49:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715222961; bh=v7wln2xpQLVVAxH/uG3eYmTTj+iPQmXfVO6dtLtvARw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=JOTE8orVPVO0pCaSPeWTSsOdhR4mLpnMOIHDMxxhPdf3yy8pCiRU5lDJd0hY7J00x Mx/UE3VXLWkUz/2M8t2YCeaQ5aSqDIlfshMCOk5hVeCHCO0/yt1zM8JTeTR/bs7t16 s5z6deoWppPqD5D5F3DLCDiYzW1J1a6dksLxqwNklJdIebFq/DElmARk1U/3kDJEem la5mdOUaf2panlFP+qGx0dMcoMZC7wyOM9FV8ZF24i4KVougPzhz6oFeDCTFY6+gHj eWQj5oLv/tSRwewkqqZWGsP7VgC7AIkylDeNnNZz46aBZBAXroenoBWLD8EQ7o5N4z JKT3ruOfBBo2A== Message-ID: <32e097e6-67f1-4f06-bad0-0c7b3afb46f0@kernel.org> Date: Thu, 9 May 2024 10:49:16 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/3] f2fs: fix to add missing iput() in gc_data_segment() To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <20240506103313.773503-1-chao@kernel.org> <20240506103313.773503-2-chao@kernel.org> Content-Language: en-US From: Chao Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/5/9 8:46, Jaegeuk Kim wrote: > On 05/06, Chao Yu wrote: >> 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); > > iget_failed() called iput()? It looks the bad inode was referenced in this context, it needs to be iput()ed here. The bad inode was made in other thread, please check description in commit b73e52824c89 ("f2fs: reposition unlock_new_inode to prevent accessing invalid inode"). Thanks, > > >> + continue; >> + } >> + >> err = f2fs_gc_pinned_control(inode, gc_type, segno); >> if (err == -EAGAIN) { >> iput(inode); >> -- >> 2.40.1