[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b9fd5cb-2494-4dbd-8779-82525cb46bf4@linux.alibaba.com>
Date: Fri, 9 Jan 2026 10:13:57 +0800
From: Jingbo Xu <jefflexu@...ux.alibaba.com>
To: Bernd Schubert <bernd@...ernd.com>, miklos@...redi.hu,
linux-fsdevel@...r.kernel.org, bschubert@....com
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fuse: invalidate the page cache after direct write
On 1/9/26 12:16 AM, Bernd Schubert wrote:
>
> The side effect should only come without FOPEN_DIRECT_IO. Could you add
> this diff to avoid it?
>
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index d6ae3b4652f8..c04296316a82 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -1177,7 +1177,13 @@ static ssize_t fuse_send_write(struct fuse_io_args *ia, loff_t pos,
> written = ia->write.out.size;
> if (!err && written > count)
> err = -EIO;
> - if (!err && written && mapping->nrpages) {
> +
> + /*
> + * without FOPEN_DIRECT_IO generic_file_direct_write() does the
> + * invalidation for us
> + */
> + if (!err && written && mapping->nrpages &&
> + (ff->open_flags & FOPEN_DIRECT_IO)) {
> /*
> * As in generic_file_direct_write(), invalidate after the
> * write, to invalidate read-ahead cache that may have competed
>
Actually I think it's more complicated:
```
/*
* 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) || !io->blocking)) {
```
I will send v2 soon if you feel good about the above diff.
--
Thanks,
Jingbo
Powered by blists - more mailing lists