mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Guanghui Yang <3497809730@qq.com>
Cc: chao@kernel.org, jaegeuk@kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] f2fs: fix ifolio leak in f2fs_move_inline_dirents
Date: Tue, 21 Jul 2026 08:47:27 +0800	[thread overview]
Message-ID: <b3a3d74c-338d-422f-b2c7-84ad00a9187d@kernel.org> (raw)
In-Reply-To: <tencent_2D9E7B21C16E6E10F2315454333C5E8A4D08@qq.com>

On 7/19/26 17:05, Guanghui Yang wrote:
> Thanks for taking a look.
> 
> f2fs_reserve_block() drops the dnode only when the inode folio was not
> provided by the caller:
> 
>          bool need_put = dn->inode_folio ? false : true;
>          ...
>          if (err || need_put)

What about err is non-zero?

>                  f2fs_put_dnode(dn);
> 
> In this path, f2fs_move_inline_dirents() passes ifolio through
> set_new_dnode(), so need_put is false and f2fs_reserve_block() keeps the
> caller-provided folio.
> 
> The caller of do_convert_inline_dir() also drops ifolio only on success:
> 
>          err = do_convert_inline_dir(dir, ifolio, inline_dentry);
>          if (!err)
>                  f2fs_folio_put(ifolio, true);
> 
> Therefore, when f2fs_reserve_block() fails, the ifolio reference still
> appears to need cleanup in f2fs_move_inline_dirents(). I kept the cleanup
> local to avoid changing f2fs_reserve_block() semantics for other callers.
> 
> Thanks,
> Guanghui
> 


  reply	other threads:[~2026-07-21  0:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13  6:40 Guanghui Yang
2026-07-19  7:21 ` Chao Yu
2026-07-19  9:05   ` Guanghui Yang
2026-07-21  0:47     ` Chao Yu [this message]
2026-07-21  1:56       ` Guanghui Yang

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=b3a3d74c-338d-422f-b2c7-84ad00a9187d@kernel.org \
    --to=chao@kernel.org \
    --cc=3497809730@qq.com \
    --cc=jaegeuk@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

all inboxes | Powered by JetHome®