public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
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()
Date: Thu, 9 May 2024 15:50:08 +0000	[thread overview]
Message-ID: <ZjzwsB2y0AVNWY7X@google.com> (raw)
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 <chao@kernel.org>
> > > ---
> > >   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

  reply	other threads:[~2024-05-09 15:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 10:33 [PATCH 1/3] f2fs: fix to release node block count in error path of f2fs_new_node_page() Chao Yu
2024-05-06 10:33 ` [PATCH 2/3] f2fs: fix to add missing iput() in gc_data_segment() Chao Yu
2024-05-09  0:46   ` Jaegeuk Kim
2024-05-09  2:49     ` Chao Yu
2024-05-09 15:50       ` Jaegeuk Kim [this message]
2024-05-10  3:36       ` [f2fs-dev] " Chao Yu
2024-05-06 10:33 ` [PATCH 3/3] f2fs: fix to do sanity check on i_nid for inline_data inode Chao Yu
2024-05-09 15:52   ` Jaegeuk Kim
2024-05-10  2:14     ` Chao Yu
2024-05-10  3:36       ` Jaegeuk Kim
2024-05-10 14:16         ` Chao Yu
2024-05-11  0:38           ` Jaegeuk Kim
2024-05-11  3:07             ` Chao Yu
2024-05-14 16:07               ` Jaegeuk Kim
2024-05-15  1:34                 ` Chao Yu
2024-05-15  4:39                   ` Jaegeuk Kim
2024-05-15  6:12                     ` Chao Yu
2024-05-20 16:32                       ` Jaegeuk Kim
2024-05-11  0:50 ` [f2fs-dev] [PATCH 1/3] f2fs: fix to release node block count in error path of f2fs_new_node_page() patchwork-bot+f2fs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZjzwsB2y0AVNWY7X@google.com \
    --to=jaegeuk@kernel.org \
    --cc=chao@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox