Re: [PATCH] f2fs: fix ifolio leak in f2fs_move_inline_dirents
From: Guanghui Yang
Date: Sun Jul 19 2026 - 05:06:06 EST
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)
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