Re: [f2fs-dev] [PATCH 07/14] f2fs: make GC migration large-folio aware

From: Daeho Jeong

Date: Wed Sep 09 2026 - 16:01:45 EST


On Mon, Sep 7, 2026 at 4:46 AM Nanzhe Zhao <nzzhao.sigma@xxxxxxxxx> wrote:
>
> On Fri, 28 Aug 2026 10:20:40 -0700, Daeho Jeong wrote:
> > Under Patch 08, a cleanly read large folio may NOT have
> > f2fs_folio_state allocated
> > (folio->private == NULL), right?
> >
> > When foreground/background GC tries to migrate a 4KB block in such a folio,
> > `ffs` is NULL, and `atomic_inc(&ffs->write_pages_pending)` will instantly crash
> > with a NULL pointer dereference!
> >
> > Fix: Call `ffs = f2fs_ffs_find_or_alloc(folio);` before accessing `ffs`.
>
> In move_data_page(), the folio is obtained via
> f2fs_get_read_data_folio() / f2fs_get_lock_data_folio(), where
> f2fs_folio_state is allocated unconditionally for large folios. So
> there shouldn't be a NULL pointer dereference here, right?
>
> Thanks,
> Nanzhe

Ah, I was confused. You're right.

Thanks for checking!
Daeho