Re: [f2fs-dev] [PATCH] f2fs: fix ifolio leak in f2fs_move_inline_dirents

Chao Yu via Linux-f2fs-devel <[email protected]> Tue, 21 Jul 2026 08:47:27 +0800
Newsgroups net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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
> 



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel