Fix GH-10548: copy() fails on cifs mounts because of incorrect length (cfr_max) specified in streams.c:1584 copy_file_range() #10551
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On some filesystems, the copy operation fails if we specify a size
larger than the file size. We use a stat call to clamp the size to copy
to the actual filesize. This stat call shouldn't impact performance
notably because stat calls can be cached. In some cases (like for /proc
files), the returned size is 0, so we should avoid problems by not using
copy_file_range in those cases (copy_file_range wouldn't work anyway on
this particular example because the syscall is not supported for /proc).
I will do some cleanups and improvements on copy_file_range (like the loop I described in #10440 in a follow-up PR for the master branch).
/cc @knowsshit It would be great if you could test this patch out and let us know if this works for you :)
/cc @arnaud-lb since he reviewed the PR I referenced in here.
Edit: CI fail in x32 is unrelated