Re: [GIT PULL] f2fs update for 7.0-rc1
From: Eric Biggers
Date: Sat Feb 14 2026 - 13:12:50 EST
On Sat, Feb 14, 2026 at 09:50:42AM -0800, Linus Torvalds wrote:
> [ Note: added fsverity people ]
>
> On Fri, 13 Feb 2026 at 18:45, Jaegeuk Kim <jaegeuk@xxxxxxxxxx> wrote:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git tags/f2fs-for-7.0-rc1
>
> So I have pulled this, but as part of going over my conflict
> resolution with the fsverity changes, I'm a bit unhappy.
>
> I'm not unhappy about the f2fs thing in particular - I'm unhappy about
> the fsverity integration side.
>
> In particular, f2fs uses fsverity_verify_page() by doing
>
> fsverity_verify_page(folio_file_page(folio,index))
>
> which looks fine, and now wants that
>
> struct fsverity_info *vi
>
> and that was part of my conflict resolution.
>
> But then I looked at what fsverity_verify_page() does, and that is just broken.
>
> Because fsverity_verify_page() looks like this:
>
> return fsverity_verify_blocks(vi, page_folio(page), PAGE_SIZE, 0);
>
> and that's garbage.
>
> We just turned the folio into a page, and now it turns it back into a
> folio - but importantly it *loses* the index of the page inside the
> folio while doing so!
>
> In other words, fsverity_verify_page() does *not* work on large
> folios. It only works when a folio is a page.
>
> And I can't just use "fsverity_verify_folio()", because that verifies
> the *whole* folio, not just the sub-page.
>
> So my resolution was to just fix this thing and make it use
> !fsverity_verify_blocks() directly, using the page offset within a
> folio explicitly.
>
> But I don't actually *really* know this code at all, and I can't
> verify my resolution, and I'm unhappy with how subtle that
> fsverity_verify_page() thing is.
>
> I was initially going to just fix fsverity_verify_page() to actually
> take the page offset into account properly, but it turns out that
> there aren't very many other users.
>
> Anyway, I *think* fsverity_verify_page() should be either fixed or
> removed. The fix would be something like this:
>
> - return fsverity_verify_blocks(vi, page_folio(page), PAGE_SIZE, 0);
> + struct folio *folio = page_folio(page);
> + unsigned int offset = folio_page_idx(folio, page) * PAGE_SIZE;
> + return fsverity_verify_blocks(vi, folio, PAGE_SIZE, offset);
>
> but I didn't do that. Instead I did a hack-job in fs/f2fs/data.c,
> which also involved changing a
>
> fsverity_verify_page(vi, &folio->page)
>
> into a
>
> fsverity_verify_folio(vi, folio)
>
> instead, because it really looked to me like it should be the whole
> folio regardless of whether it was a large folio (broken before) or
> not (working if so).
>
> It's entirely possible that this code only deals with small page-sized
> folios, in which case it doesn't matter. But that
> f2fs_read_data_large_folio() code is definitely about multi-page
> folios.
>
> There's another fsverity_verify_page() use in fs/f2fs/compress.c. and
> I didn't touch that one. The code doesn't use folios at all, so maybe
> it only triggers for page == folio. I don't know, and that's when I
> just started going "Somebody who knows this code needs to fix this".
>
> Anyway, I think that fsverity_verify_page() case should be removed
> too, and then the subtly broken function can just be deleted entirely
> instead of being fixed.
>
> Comments? Did I mess something up? Am I just being confused?
>
> Regardless, please verify my merge resolution, and please do
> *something* about that fsverity_verify_page() situation.
Your merge resolution looks good. Thanks for catching this.
The history behind this is that fsverity_verify_page() came first,
before folios existed. The functions that take a folio,
fsverity_verify_blocks() and fsverity_verify_folio(), were added later.
fsverity_verify_page() was kept around for compatibility with the
existing callers in ext4, f2fs, and btrfs. It wasn't updated to take
the index of the page in its containing folio into account, as it was
intended for the existing non-large-folio-aware callers.
But now that only one caller of fsverity_verify_page() is left (the one
in f2fs_verify_cluster()), we should indeed convert that to use
fsverity_verify_blocks() and remove fsverity_verify_page(). I'll plan
to do that through the fsverity tree soon, if that's okay with the f2fs
folks.
- Eric