-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fs.copyFile fails with permission denied when source is read-only #3322
Comments
I'm more than willing to believe network file systems are still troublemakers. I don't have time to investigate but I can review pull requests. |
Thanks for answering. I'll have to dig into libuv in that case and see how it can be fixed. I had a quick look and it sounds like it's |
It probably needs to be handled the same way libuv deals with buggy cephfs mounts, by detecting and blacklisting at runtime. You're right that backwards-incompatible API changes won't be accepted into the v1.x branch. |
Humm... I'm thinking that My proposal would be that if we get a Does that sound right to you? If it looks like I'm on the right track for an implementation, I'll set it up and test then push the PR for review. |
It's been reported that copy_file_range() on a CIFS mount fails with an EPERM error, even though the source and target files have the appropriate permissions. This is probably a variation on the EPERM error that libuv handles when it tries to fchmod() a file on a CIFS mount that hasn't been mounted with the "noperm" option, so let's handle it here too. This commit applies minor refactoring because the "work around file system bugs" section got quite unwieldy. I also snuck in a bug fix where the workaround for buggy CephFS mounts disabled copy_file_range() permanently. Fixes: libuv#3322
It's been reported that copy_file_range() on a CIFS mount fails with an EPERM error, even though the source and target files have the appropriate permissions. This is probably a variation on the EPERM error that libuv handles when it tries to fchmod() a file on a CIFS mount that hasn't been mounted with the "noperm" option, so let's handle it here too. This commit applies minor refactoring because the "work around file system bugs" section got quite unwieldy. I also snuck in a bug fix where the workaround for buggy CephFS mounts disabled copy_file_range() permanently. Fixes: #3322
I haven't had a chance to test it yet (didn't look into how to build nodejs with a custom libuv), but reviewing the code, it seems to handle CIFS only, but not CephFS, so it wouldn't fix my specific problem, but the patch looks good otherwise and would likely fix the problem I saw on CIFS and if the check for filesystem was done for type cephfs too, then it would likely solve it for me. |
You can normally drop libuv in node's deps/uv, then run Can you check if the cephfs bug still exists in newer kernels? I suspect it's fixed in 4.20 but you're running 4.19, right? |
It's been reported that copy_file_range() on a CIFS mount fails with an EPERM error, even though the source and target files have the appropriate permissions. This is probably a variation on the EPERM error that libuv handles when it tries to fchmod() a file on a CIFS mount that hasn't been mounted with the "noperm" option, so let's handle it here too. This commit applies minor refactoring because the "work around file system bugs" section got quite unwieldy. I also snuck in a bug fix where the workaround for buggy CephFS mounts disabled copy_file_range() permanently. Fixes: libuv#3322
Trying to copy a read-only file onto a ceph-fuse filesystem fails, returning an `EACCES` error. This happens when the destination doesn't exist yet, and a new file is created. By checking that the error matches, and that the destination file is empty, we can fix this issue while waiting for a proper Ceph fix to be upstreamed. Fixes: libuv#3919 Refs: nodejs/node#37284 Refs: libuv#3117 Refs: libuv#3322
Commenting here for posterity: |
Trying to copy a read-only file onto a ceph-fuse filesystem fails, returning an `EACCES` error. This happens when the destination doesn't exist yet, and a new file is created. By checking that the error matches, and that the destination file is empty, we can fix this issue while waiting for a proper Ceph fix to be upstreamed. Fixes: #3919 Refs: nodejs/node#37284 Refs: #3117 Refs: #3322
Reposting this as a new issue since I cannot re-open issue #3117 and it appears comments from a closed issue might not be seen, as I have not received a response in 6 weeks : #3117 (comment)_
I see that this fix was released as part of libuv 1.42.0 which was included in node 16.7.0 released last week.
I've tested my previous test case with node 16.7.0 and unfortunately the issue is still there.
Note that I was also able to reproduce a similar problem with a
cifs
mount (which also affects 12.18.x) and which also still happens in 16.7.0. Hopefully, withcifs
(SMB mount), it should make it much easier to test and reproduce the issue on dev environments.docker run --rm -it -v /cifs-mount/tmp:/mount node:12.19.0-alpine /bin/sh
(Note that running the same commands as above but without the
chmod -w
on the input file does not result in any errors.)The difference between
cifs
andcephfs
mounts in the behavior is that cephfs doesn't have the issue on node 12.18.4 (libuv 1.38.0), but has the problem on node 12.19.0 (libuv 1.39.0), while cifs has the problem on both versions. The other difference is with cifs, the target file actually gets created (but empty), despite the fact that it throws the EPERM error, while on cephfs, it will not create the target file at all.Note that I tested/confirmed the cephfs behavior on Linux 4.19.0-13 (
Linux 4.19.0-13-cloud-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux
) while I tested/confirmed the cifs behavior on Linux 5.0.16-100 (Linux 5.0.16-100.fc28.x86_64 #1 SMP Tue May 14 18:22:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
)The text was updated successfully, but these errors were encountered: