[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1fa83cdf-010b-4e95-9dcc-0e9f5cefa68b@linux.alibaba.com>
Date: Fri, 9 Jan 2026 10:21:31 +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
Hi Bernd,
On 1/9/26 10:13 AM, Jingbo Xu wrote:
>
>
> 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.
>
Sorry I just realized that the invalidation for asynchronous write will
be done in fuse_aio_complete() of v1 patch.
I will apply the diff you suggested and send v2 soon.
--
Thanks,
Jingbo
Powered by blists - more mailing lists