Re: [PATCH v3] fuse: invalidate the page cache after direct write

From: Miklos Szeredi

Date: Fri Feb 27 2026 - 10:15:25 EST


On Sun, 11 Jan 2026 at 08:37, Jingbo Xu <jefflexu@xxxxxxxxxxxxxxxxx> wrote:
>
> This fixes xfstests generic/451 (for both O_DIRECT and FOPEN_DIRECT_IO
> direct write).
>
> Commit b359af8275a9 ("fuse: Invalidate the page cache after
> FOPEN_DIRECT_IO write") tries to fix the similar issue for
> FOPEN_DIRECT_IO write, which can be reproduced by xfstests generic/209.
> It only fixes the issue for synchronous direct write, while omitting
> the case for asynchronous direct write (exactly targeted by
> generic/451).
>
> While for O_DIRECT direct write, it's somewhat more complicated. For
> synchronous direct write, generic_file_direct_write() will invalidate
> the page cache after the write, and thus it can pass generic/209. While
> for asynchronous direct write, the invalidation in
> generic_file_direct_write() is bypassed since the invalidation shall be
> done when the asynchronous IO completes. This is omitted in FUSE and
> generic/451 fails whereby.
>
> Fix this by conveying the invalidation for both synchronous and
> asynchronous write.
>
> - with FOPEN_DIRECT_IO
> - sync write, invalidate in fuse_send_write()
> - async write, invalidate in fuse_aio_complete() with FUSE_ASYNC_DIO,
> fuse_send_write() otherwise
> - without FOPEN_DIRECT_IO
> - sync write, invalidate in generic_file_direct_write()
> - async write, invalidate in fuse_aio_complete() with FUSE_ASYNC_DIO,
> generic_file_direct_write() otherwise
>
> Reviewed-by: Bernd Schubert <bschubert@xxxxxxx>
> Signed-off-by: Jingbo Xu <jefflexu@xxxxxxxxxxxxxxxxx>

Applied, thanks.

Miklos