From: Niels de Vos <ndevos@redhat.com>
To: Yichong Chen <chenyichong@uniontech.com>,
Miklos Szeredi <miklos@szeredi.hu>
Cc: fuse-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fuse: skip destination updates for zero-byte copy
Date: Thu, 23 Jul 2026 12:33:38 +0200 [thread overview]
Message-ID: <dac098e12a3a28785e7bebc0597cc8b7f0ab720e.camel@redhat.com> (raw)
In-Reply-To: <20260723100743.93881-1-chenyichong@uniontech.com>
On Thu, 2026-07-23 at 18:07 +0800, Yichong Chen wrote:
> __fuse_copy_file_range() may receive a successful copy reply with
> zero
> bytes copied. This can happen even though the VFS only calls the
> file
> operation with a non-zero length, for example if the FUSE daemon
> reaches
> EOF while the kernel has stale source size information.
>
> In that case no data was written to the destination. Do not
> invalidate
> the destination page cache or update the destination timestamps and
> cached
> size state for a zero-byte copy result.
>
> Fixes: 88bc7d5097a1 ("fuse: add support for copy_file_range()")
> Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
> ---
> fs/fuse/file.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index ceada75310b8..75eb97b26912 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -3040,6 +3040,10 @@ static ssize_t __fuse_copy_file_range(struct
> file *file_in, loff_t pos_in,
> err = -EIO;
> goto out;
> }
> + if (!bytes_copied) {
> + err = 0;
> + goto out;
> + }
>
> truncate_inode_pages_range(inode_out->i_mapping,
> ALIGN_DOWN(pos_out, PAGE_SIZE),
Thanks, this looks good to me.
My style preference would be to make it an "else if" because bytes_copied is
used in the if-statement above already too. I don't think it is required to
adjust this, the functioning will remain the same.
Acked-by: Niels de Vos <ndevos@ibm.com>
next prev parent reply other threads:[~2026-07-23 10:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 10:07 Yichong Chen
2026-07-23 10:33 ` Niels de Vos [this message]
2026-07-23 10:43 ` Amir Goldstein
2026-07-24 10:55 ` Yichong Chen
2026-07-24 11:24 ` Horst Birthelmer
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=dac098e12a3a28785e7bebc0597cc8b7f0ab720e.camel@redhat.com \
--to=ndevos@redhat.com \
--cc=chenyichong@uniontech.com \
--cc=fuse-devel@lists.linux.dev \
--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®