Re: [PATCH v2] fuse: invalidate the page cache after direct write
From: Bernd Schubert
Date: Fri Jan 09 2026 - 09:05:50 EST
On 1/9/26 08:01, Jingbo Xu wrote:
> - return err ?: ia->write.out.size;
> + /*
> + * As in generic_file_direct_write(), invalidate after the write, to
> + * invalidate read-ahead cache that may have competed with the write.
> + * Without FOPEN_DIRECT_IO, generic_file_direct_write() does the
> + * invalidation for synchronous write.
> + */
> + if (!err && written && mapping->nrpages &&
> + ((ff->open_flags & FOPEN_DIRECT_IO) || !ia->io->blocking)) {
> + invalidate_inode_pages2_range(mapping, pos >> PAGE_SHIFT,
> + (pos + written - 1) >> PAGE_SHIFT);
> + }
> +
> + return err ?: written;
> }
Sorry, but I'm confused about "|| !ia->io->blocking". When we go into this
code path it either via generic_file_direct_write(), which then
already invalidates or directly and then
(ff->open_flags & FOPEN_DIRECT_IO) is set?
Thanks,
Bernd