Re: [f2fs-dev] [PATCH 07/14] f2fs: make GC migration large-folio aware
From: Nanzhe Zhao
Date: Mon Sep 07 2026 - 07:54:48 EST
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