From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: Bernd Schubert <bernd@bsbernd.com>,
miklos@szeredi.hu, linux-fsdevel@vger.kernel.org,
bschubert@ddn.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fuse: invalidate the page cache after direct write
Date: Fri, 9 Jan 2026 10:13:57 +0800 [thread overview]
Message-ID: <5b9fd5cb-2494-4dbd-8779-82525cb46bf4@linux.alibaba.com> (raw)
In-Reply-To: <b6cfc411-8d2e-45c2-b237-e79f71016bbb@bsbernd.com>
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
next prev parent reply other threads:[~2026-01-09 2:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 7:52 Jingbo Xu
2026-01-08 16:16 ` Bernd Schubert
2026-01-09 2:13 ` Jingbo Xu [this message]
2026-01-09 2:21 ` Jingbo Xu
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=5b9fd5cb-2494-4dbd-8779-82525cb46bf4@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=bernd@bsbernd.com \
--cc=bschubert@ddn.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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
all inboxes | Powered by JetHome®