From: Eric Biggers <ebiggers@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>, Theodore Ts'o <tytso@mit.edu>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux F2FS Dev Mailing List
<linux-f2fs-devel@lists.sourceforge.net>
Subject: Re: [GIT PULL] f2fs update for 7.0-rc1
Date: Sat, 14 Feb 2026 10:11:58 -0800 [thread overview]
Message-ID: <20260214181158.GA2872@sol> (raw)
In-Reply-To: <CAHk-=wiWPQdT+Gs=mHNaCfuVahCxU6eubBQ4cVwXkW9s5nMRuA@mail.gmail.com>
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@kernel.org> 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
next prev parent reply other threads:[~2026-02-14 18:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-14 2:45 [GIT PULL] f2fs update for 7.0-rc1 Jaegeuk Kim
2026-02-14 17:50 ` Linus Torvalds
2026-02-14 18:11 ` Eric Biggers [this message]
2026-02-14 17:52 ` [f2fs-dev] " pr-tracker-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260214181158.GA2872@sol \
--to=ebiggers@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox