From 05dee56f45dae37745f21a95e19a149b69e719e3 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Mon, 27 Feb 2023 09:30:05 +0100 Subject: [PATCH] Also handle copy_file_range failing with ENOENT There appears to be a kernel bug (?) that CIFS fails with ENOENT on copy_file_range. coreutils had to work around this as well, see the included link. (cherry picked from commit 00840d05abd875e1901b655ed6af3bc76ef48433) --- src/ioslaves/file/file_unix.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ioslaves/file/file_unix.cpp b/src/ioslaves/file/file_unix.cpp index 1865b852d9..8d005daf81 100644 --- a/src/ioslaves/file/file_unix.cpp +++ b/src/ioslaves/file/file_unix.cpp @@ -822,7 +822,9 @@ void FileProtocol::copy(const QUrl &srcUrl, const QUrl &destUrl, int _mode, JobF const ssize_t copiedBytes = ::copy_file_range(srcFile.handle(), nullptr, destFile.handle(), nullptr, s_maxIPCSize, 0); if (copiedBytes == -1) { - if (errno == EINVAL || errno == EXDEV) { + // ENOENT is returned on cifs in some cases, probably a kernel bug + // (s.a. https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=7fc84d1c0f6b35231b0b4577b70aaa26bf548a7c) + if (errno == EINVAL || errno == EXDEV || errno == ENOENT) { break; // will continue with next copy mechanism } -- GitLab