Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp1259319lqo; Thu, 9 May 2024 08:50:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWZsqZYh3ORZbE6AJ0KLamZpSoAhRMk2DC85yb7SyPnxmL7jw7L3+LW/HSfe45WZD0rISlLeXI1HW0hJKWWbw1ziSje2ILtcYRtchbaSg== X-Google-Smtp-Source: AGHT+IF+pghtTplmGOfyRWNDKi9feo3b+8oFM9CWlph+GYVV0F3FJChL9Ju3ADGZmuyPFu7g7/A6 X-Received: by 2002:a17:902:b18d:b0:1ea:9596:11eb with SMTP id d9443c01a7336-1ef44061229mr71295ad.60.1715269846203; Thu, 09 May 2024 08:50:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715269846; cv=pass; d=google.com; s=arc-20160816; b=DiM/S0J4JcjThq0U2osojai3ZqyR94U7KpDkzSsI+fWSCMoq/pmzkkdJ505be7wWTU yU8VylAP2fZcFNEAKIaIlkGikNakS295qo/ErgpE8UVMFKYULE97Mu6SdgO4SwWqvk3s Hguf/tPz8Ln4LZENqVXOp+KV/Q6M6QjB14Es8nvBSc4DIzZhUAPSR8jQfj6qUa6+FoJ2 kYpdSB/BQDvSnQXRyuV7RsnRJmqCOuXEmCoqP5ERVpFg4YdA6CntiQCDtaOwr6wk0zLK shtXCVF2psV5RbqURxynT2vBYEuY5Llnf6PH5UYyTLRn0+ihyelEFp++06jL8coGPl2A IDkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WYxU5HJMz5HLIBUR2c0Dd6ti9T3sxll8z9kvkN/FPNY=; fh=/W2dXBmPOYAkmC9wIpZGDoyRD7a7iUo6ekQ/c7AKhqw=; b=ETcCiZ/NSNuZWSqETfnxOuxPUab8pWkuDLMgw2BB2yJyB12bVQsAm2z2Iah4byWZX6 hqfbakUYXCT9SUIVuVjOiaet0uvGUYypmHlqDBWWWhHZPFkjsT60O7ujSMfifdvwJhAI YESyENzbSxp/3269CLYmr3TayjfjYuryTU/0hwTW23cqxQTHzBaWi44TPhgIevBSeXb5 ccvEWJR4ArwxI34vGXUiCMGr6A2aTdfBonQKbE01TKaNDyjVVnoEI22D/zf9kZBejH5a R8mZPrEQ3aHRwpLqzggRj4npzaK6Rh6kUHnblaI+CkaBb8xmQsGr4K39t4DiJsF0VSgm XN+A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LsWqlUPi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-174654-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174654-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0b9cf240si17227085ad.25.2024.05.09.08.50.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 08:50:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174654-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LsWqlUPi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-174654-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174654-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C5982282EA6 for ; Thu, 9 May 2024 15:50:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F32616F846; Thu, 9 May 2024 15:50:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LsWqlUPi" 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 9C37A16F0C3 for ; Thu, 9 May 2024 15:50:10 +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=1715269810; cv=none; b=gwnmOFqUCOt4Ei6l/zihyNJk1CTznuyNb3WPY9jbfVWMP/YwaKXOpR13+XA5DYdce7Pk34dzTS2fgW/t8ImbbFRgA0T7/Dt5i4JEfdhWbKEoxNdXuh3DUwDjaE4ALFuMIhdjlWwj5jh3QukfdyhcnByAseZpWpQBwUBjhM8hvTg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715269810; c=relaxed/simple; bh=PVYxLVi7qmywbA3AVz6ygRy87Rw7WwcdjDJdNALqThU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oyTQ4SIJ8aVoZY38RFbu//vAZZ+fA+540UTVWxQUBtMH/G++YS4Dqs0flkdU2HW4kKkW2DEpE1sFgorp3Jvs/LxcmDC61ubA/H7lTS3ThfE1aCFIRP8OCf+fu3ByBA5n0+LmqgQ8wnCqIOhU5fluEZLpKLJpzTo4e9YKV0yZkPM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LsWqlUPi; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49948C116B1; Thu, 9 May 2024 15:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715269810; bh=PVYxLVi7qmywbA3AVz6ygRy87Rw7WwcdjDJdNALqThU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LsWqlUPisLmYwN5tQdh1E0gO+IF2GCueWzv/buL6tw9bnn8FsE72xoBX/eQXqBH1s zQ+0cM7qRPDj20bIlatAyK9pebFMCpVhjCCmbi8R9zCYivIw27cKj/Czh437tqYUIM 4W63s66NxRCvzJnVSvI3ogR2uNmF5rJ6GOxpSzwd15/np6b1L/NmIW7AqO39cciat3 hOcDvePD6rq/sQ6Jiec1y/hh2won+7aSn1ltqAG//jfYcO5EbjOeWyQF73qhn0rk6x 5oz98MkpLKG0DqznXsPzMHu78krvF+aCBMebSP+p0AylW5cPHv7mY9DZrmtiE2ENpt 037Liu2sNSEag== Date: Thu, 9 May 2024 15:50:08 +0000 From: Jaegeuk Kim To: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] f2fs: fix to add missing iput() in gc_data_segment() Message-ID: References: <20240506103313.773503-1-chao@kernel.org> <20240506103313.773503-2-chao@kernel.org> <32e097e6-67f1-4f06-bad0-0c7b3afb46f0@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <32e097e6-67f1-4f06-bad0-0c7b3afb46f0@kernel.org> On 05/09, Chao Yu wrote: > 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"). Ah, it's non-error case. Right. > > Thanks, > > > > > > > > + continue; > > > + } > > > + > > > err = f2fs_gc_pinned_control(inode, gc_type, segno); > > > if (err == -EAGAIN) { > > > iput(inode); > > > -- > > > 2.40.1