Re: [f2fs-dev] [PATCH 05/14] f2fs: support large folio writeback

From: Daeho Jeong

Date: Wed Sep 09 2026 - 17:30:02 EST


On Sun, Sep 6, 2026 at 8:57 PM Nanzhe Zhao <nzzhao.sigma@xxxxxxxxx> wrote:
>
> On Thu, 3 Sep 2026 21:04:36 -0700, Daeho Jeong wrote:
> > In __has_merged_page(), target->mapping is directly dereferenced. For tail
> > pages, target->mapping contains compound_head metadata rather than a valid
> > address_space pointer, leading to a kernel crash when accessing
> > target->mapping->host.
>
> Thanks for the review.
>
> I've been testing on 6.18-based (Android) and 7.2-rc5 trees, and in
> both of them bio_for_each_folio_all() goes through bio_first_folio(),
> which resolves the head folio from the bvec directly:
>
> fi->folio = page_folio(bvec->bv_page);
>
> So the folio yielded to __has_merged_page() should always be the head
> folio there.
>
> Are you testing on a 6.12-based Android kernel? In 6.12,
> __has_merged_page() still iterated with bio_for_each_segment_all() and
> took bvec->bv_page directly as target, so a tail page would make
> target->mapping point at the compound_head metadata and crash on
> target->mapping->host.
>
> If so, would it be possible to retest on a 6.18 Android kernel, where
> the iterator normalizes to the head folio?

Yes, you are right. I forgot I backported your patch to 6.12 kernel to
check whether it's working. :)
Thanks for the confirmation.

>
> Thanks,
> Nanzhe