linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bernd Schubert <bschubert@ddn.com>
To: Luis Henriques <luis@igalia.com>, Miklos Szeredi <mszeredi@redhat.com>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	Florian Weimer <fweimer@redhat.com>
Subject: Re: [PATCH 1/2] fuse: fix COPY_FILE_RANGE interface
Date: Wed, 6 Aug 2025 19:43:00 +0000	[thread overview]
Message-ID: <3bf4f5f5-bfab-47cb-815b-979b56821cc5@ddn.com> (raw)
In-Reply-To: <87pld8kdwt.fsf@wotan.olymp>

On 8/6/25 11:17, Luis Henriques wrote:
> On Tue, Aug 05 2025, Miklos Szeredi wrote:
> 
>> The FUSE protocol uses struct fuse_write_out to convey the return value of
>> copy_file_range, which is restricted to uint32_t.  But the COPY_FILE_RANGE
>> interface supports a 64-bit size copies.
>>
>> Currently the number of bytes copied is silently truncated to 32-bit, which
>> is unfortunate at best.
>>
>> Introduce a new op COPY_FILE_RANGE_64, which is identical, except the
>> number of bytes copied is returned in a 64-bit value.
>>
>> If the fuse server does not support COPY_FILE_RANGE_64, fall back to
>> COPY_FILE_RANGE and truncate the size to UINT_MAX - 4096.
> 
> I was wondering if it wouldn't make more sense to truncate the size to
> MAX_RW_COUNT instead.  My reasoning is that, if I understand the code
> correctly (which is probably a big 'if'!), the VFS will fallback to
> splice() if the file system does not implement copy_file_range.  And in
> this case splice() seems to limit the operation to MAX_RW_COUNT.

I personally don't like the hard coded value too much and would use

inarg.len = min_t(size_t, len, (UINT_MAX - 4096));

(btw, 0xfffff000 is UINT_MAX - 4095, isn't it?).

Though that is all nitpick. The worst part that could happen are
applications that do not handle partial file copy and then wouldn't
copy the entire file. For these it probably would be better to return
-ENOSYS.

LGTM, 

Reviewed-by: Bernd Schubert <bschubert@ddn.com>

  parent reply	other threads:[~2025-08-06 21:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-05 18:30 [PATCH 1/2] fuse: fix COPY_FILE_RANGE interface Miklos Szeredi
2025-08-05 18:30 ` [PATCH 2/2] copy_file_range: limit size if in compat mode Miklos Szeredi
2025-08-12 11:21   ` Miklos Szeredi
2025-08-15 14:22     ` Christian Brauner
2025-08-12 14:26   ` Amir Goldstein
2025-08-12 15:50     ` Miklos Szeredi
2025-08-06  9:17 ` [PATCH 1/2] fuse: fix COPY_FILE_RANGE interface Luis Henriques
2025-08-06 16:01   ` Darrick J. Wong
2025-08-06 19:48     ` Luis Henriques
2025-08-11 15:45       ` Darrick J. Wong
2025-08-06 19:43   ` Bernd Schubert [this message]
2025-08-12  9:08     ` Chunsheng Luo
2025-08-12 19:49       ` Darrick J. Wong
2025-08-07  6:24 ` Chunsheng Luo
2025-08-11 15:47   ` Darrick J. Wong

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=3bf4f5f5-bfab-47cb-815b-979b56821cc5@ddn.com \
    --to=bschubert@ddn.com \
    --cc=fweimer@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=luis@igalia.com \
    --cc=mszeredi@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).