summaryrefslogtreecommitdiff
path: root/kde-frameworks/kio/files/kio-5.104.0-handle-copy_file_range-failing-w-ENOENT.patch
blob: ae10923bb774945aa9e1ea5fe38b753bce1b9be2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 05dee56f45dae37745f21a95e19a149b69e719e3 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
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