linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Amiantov <ab@fmap.me>
To: Matthew Wilcox <willy@infradead.org>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	fuse-devel@lists.sourceforge.net,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Amir Goldstein <amir73il@gmail.com>,
	fuse-devel@lists.linux.dev, linux-mm <linux-mm@kvack.org>
Subject: Re: [fuse-devel] Debugging a stale kernel cache during file growth
Date: Fri, 17 Apr 2026 13:24:16 +0700	[thread overview]
Message-ID: <800fa535-da92-41c0-bea9-40ee27639502@fmap.me> (raw)
In-Reply-To: <aeFuarTL7xBbut0F@casper.infradead.org>

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

On 4/17/26 06:19, Matthew Wilcox wrote:
> Yes, at this point, you've left the folio in an error state.  I'm sure you
> didn't mean to do that, but the VFS interprets unlocked && !uptodate as
> "an error happened" (there is a minor exception to this involving failed
> readahead, but let's set that aside).

Thanks, I see!

To save my reasoning somewhere: another way to do this would be 
NFS/CIFS-style, in a lazy way. They set a flag in `getattr` and 
invalidate later in `read()` instead. This could avoid relocking the 
spinlock; I still opted for invalidating inside `getattr` though since 
FUSE already has invalidation later in the same call, and the cost of 
relocking feels low to me in this case.

Any ideas on how to resolve the remaining race condition [1]? If I'm 
correct it affects any network FS, and can't be fixed without changing 
the common VFS code somehow. I'd like someone to confirm my conclusions 
though.

I'm way over my head here though willing to learn; if someone is willing 
to mentor me on designing the fix, I'd be happy to. My best uneducated 
guess is to introduce another flag for a page and check it *after* we 
get the inode size in `filemap_read()`; if it's set, retry reading.

1: https://github.com/abbradar/nfs_stale_cache_test

[-- Attachment #2: Type: text/html, Size: 1853 bytes --]

  reply	other threads:[~2026-04-17  6:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <898a4e10-6193-4671-b3b1-7c7bc562a671@fmap.me>
     [not found] ` <CAOQ4uxjoS-PvnZ2poh0bx0C6ocTYwuEpfV0q5md15SjS620OMg@mail.gmail.com>
2026-04-16 12:12   ` Miklos Szeredi
2026-04-16 12:41     ` Nikolay Amiantov
2026-04-16 12:49       ` Nikolay Amiantov
2026-04-16 23:19       ` Matthew Wilcox
2026-04-17  6:24         ` Nikolay Amiantov [this message]
2026-04-16 22:54     ` Matthew Wilcox

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=800fa535-da92-41c0-bea9-40ee27639502@fmap.me \
    --to=ab@fmap.me \
    --cc=amir73il@gmail.com \
    --cc=fuse-devel@lists.linux.dev \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=miklos@szeredi.hu \
    --cc=willy@infradead.org \
    /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