]> Cypherpunks repositories - gostls13.git/commitdiff
internal/poll: note that copy_file_range bug is fixed
authorMichael Pratt <mpratt@google.com>
Mon, 27 Jan 2025 21:50:35 +0000 (16:50 -0500)
committerGopher Robot <gobot@golang.org>
Wed, 19 Feb 2025 22:50:50 +0000 (14:50 -0800)
We shouldn't drop the workaround in case we're running on an unpatched
kernel.

For #44272.

Change-Id: I6a6a636cb81c31856ac9b682e7d02fa1d8efa5d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/644878
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

src/internal/poll/copy_file_range_linux.go

index 50b9f1bc08ce120613b378ad539553a3db4fd99a..edaf60fe95c934c333d9610027cec0308372785e 100644 (file)
@@ -67,10 +67,11 @@ func handleCopyFileRangeErr(err error, copied, written int64) (bool, error) {
                return false, nil
        case nil:
                if copied == 0 {
-                       // If we did not read any bytes at all,
-                       // then this file may be in a file system
-                       // where copy_file_range silently fails.
-                       // https://lore.kernel.org/linux-fsdevel/20210126233840.GG4626@dread.disaster.area/T/#m05753578c7f7882f6e9ffe01f981bc223edef2b0
+                       // Prior to Linux 5.19
+                       // (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=868f9f2f8e004bfe0d3935b1976f625b2924893b),
+                       // copy_file_range can silently fail by reporting
+                       // success and 0 bytes written. Assume such cases are
+                       // failure and fallback to a different copy mechanism.
                        if written == 0 {
                                return false, nil
                        }