Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unix: check for EXDEV for uv__fs_copy_file_range #3108

Closed
wants to merge 2 commits into from

Conversation

RaisinTen
Copy link
Contributor

copy_file_range will not work when in_fd and out_fd
are not on the same mounted filesystem (pre Linux 5.3).

Fixes: nodejs/node#37284
Refs: https://www.man7.org/linux/man-pages/man2/copy_file_range.2.html#ERRORS

copy_file_range will not work when in_fd and out_fd
are not on the same mounted filesystem (pre Linux 5.3).

Fixes: nodejs/node#37284
Refs: https://www.man7.org/linux/man-pages/man2/copy_file_range.2.html#ERRORS
src/unix/fs.c Outdated
@@ -929,6 +929,11 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
} else if (r == -1 && errno == ENOTSUP) {
/* ENOTSUP - it could work on another file system type */
errno = 0;
} else if (r == -1 && errno == EXDEV) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can combine this with the previous else if:

} else if (r == -1 && (errno == ENOTSUP || errno == EXDEV)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cjihrig I combined the checks. PTAL.

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cjihrig pushed a commit that referenced this pull request Feb 13, 2021
copy_file_range will not work when in_fd and out_fd
are not on the same mounted filesystem (pre Linux 5.3).

Refs: nodejs/node#37284
PR-URL: #3108
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
@cjihrig
Copy link
Contributor

cjihrig commented Feb 13, 2021

Landed in 70f67d8. Thanks!

@cjihrig cjihrig closed this Feb 13, 2021
@RaisinTen RaisinTen deleted the unix/check-for-EXDEV branch February 14, 2021 05:39
JeffroMF pushed a commit to JeffroMF/libuv that referenced this pull request May 16, 2022
copy_file_range will not work when in_fd and out_fd
are not on the same mounted filesystem (pre Linux 5.3).

Refs: nodejs/node#37284
PR-URL: libuv#3108
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fs.copyFile fails with permission denied when source is read-only
3 participants