Uh oh!
There was an error while loading. Please reload this page.
Workarounds for copy_file_range issues - #75428
Conversation
…ttemted on a NFS mount under RHEL/CentOS 7. The syscall is supposed to return ENOSYS in most cases but when calling it on NFS it may leak through EOPNOTSUPP even though that's supposed to be handled by the kernel and not returned to userspace. Since it returns ENOSYS in some cases anyway this will trip the HAS_COPY_FILE_RANGE detection anyway, so treat EOPNOTSUPP as if it were a ENOSYS. https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/7.8_release_notes/deprecated_functionality#the_literal_copy_file_range_literal_call_has_been_disabled_on_local_file_systems_and_in_nfshttps://bugzilla.redhat.com/show_bug.cgi?id=1783554
rust-highfive
commented
Aug 11, 2020
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joshtriplett (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
joshtriplett
commented
Aug 12, 2020
@bors r+ |
bors
commented
Aug 12, 2020
📌 Commit 1316c78 has been approved by |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bors
commented
Aug 12, 2020
⌛ Testing commit 1316c78 with merge c0e06fb4d88cf4063d23e407c155a2096b4ac611... |
rust-log-analyzer
commented
Aug 12, 2020
Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
bors
commented
Aug 12, 2020
💔 Test failed - checks-actions |
the8472
commented
Aug 12, 2020
The bors error is not helpful, spurious failure? |
Uh oh!
There was an error while loading. Please reload this page.
… on file size This solves several problems - race conditions where a file is truncated while copying from it. if we blindly trusted the file size this would lead to an infinite loop - proc files appearing empty to copy_file_range but not to read/write coreutils/coreutils@4b04a0c - copy_file_range returning 0 for some filesystems (overlay? bind mounts?) inside docker, again leading to an infinite loop
the8472
commented
Aug 14, 2020
Updated to address an additional copy_file_range issue. |
the8472
commented
Aug 14, 2020
ping @joshtriplett |
| while written < max_len { | ||
| let copy_result = if has_copy_file_range { | ||
| let bytes_to_copy = cmp::min(len - written, usize::MAX as u64) as usize; | ||
| let bytes_to_copy = cmp::min(max_len - written, usize::MAX as u64) as usize; |
There was a problem hiding this comment.
Is it really necessary to keep track of max_len - written accurately at this point? It's probably okay just to pass a large constant size on every call.
There was a problem hiding this comment.
It avoids overflowing an u64. Plus I want to reuse the code in #75272 which will require exact max sizes
bors
commented
Sep 5, 2020
⌛ Testing commit 4ddedd5 with merge 596b8ed70633bf181a3b8966fb235e91a67ae146... |
bors
commented
Sep 5, 2020
💥 Test timed out |
Dylan-DPC-zz
commented
Sep 5, 2020
@bors retry |
…triplett Workarounds for copy_file_range issues fixesrust-lang#75387fixesrust-lang#75446
bors
commented
Sep 5, 2020
⌛ Testing commit 4ddedd5 with merge f9b36230f023ae6f396f3cc4284cd41a0583b819... |
bors
commented
Sep 5, 2020
💔 Test failed - checks-actions |
the8472
commented
Sep 5, 2020
I don't see how linux-only code changes can make a mingw build fail. Doubly so when it's doc tests. |
nagisa
commented
Sep 5, 2020
@bors retry |
bors
commented
Sep 5, 2020
bors
commented
Sep 5, 2020
☀️ Test successful - checks-actions, checks-azure |
implement better availability probing for copy_file_range Followup to rust-lang#75428 (comment) Previously syscall detection was overly pessimistic. Any attempt to copy to an immutable file (EPERM) would disable copy_file_range support for the whole process. The change tries to copy_file_range on invalid file descriptors which will never run into the immutable file case and thus we can clearly distinguish syscall availability.
fixes#75387
fixes#75446