aboutsummaryrefslogtreecommitdiff
path: root/src/internal/poll/copy_file_range_linux.go
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo@golang.org>2021-03-23 16:43:18 +0100
committerFilippo Valsorda <filippo@golang.org>2021-03-23 16:43:18 +0100
commit229a39e347178614d2b5c103cbdc96b7f30a015a (patch)
tree74cd619fe213fe2047d4ae31d8a99cdee9e84208 /src/internal/poll/copy_file_range_linux.go
parent055f1da6e6b96d4de842fd80773dea6d977fc025 (diff)
parentdcffdac515a1d409bcb61783d57ddb137b4741b9 (diff)
downloadgo-229a39e347178614d2b5c103cbdc96b7f30a015a.tar.gz
go-229a39e347178614d2b5c103cbdc96b7f30a015a.zip
[dev.boringcrypto.go1.15] all: merge go1.15.10 into dev.boringcrypto.go1.15
Change-Id: I2ac6b45dbfcfdaf956f2f4b11b60f8d24130141b
Diffstat (limited to 'src/internal/poll/copy_file_range_linux.go')
-rw-r--r--src/internal/poll/copy_file_range_linux.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/internal/poll/copy_file_range_linux.go b/src/internal/poll/copy_file_range_linux.go
index fc34aef4cb..01b242a4ea 100644
--- a/src/internal/poll/copy_file_range_linux.go
+++ b/src/internal/poll/copy_file_range_linux.go
@@ -112,7 +112,15 @@ func CopyFileRange(dst, src *FD, remain int64) (written int64, handled bool, err
return 0, false, nil
case nil:
if n == 0 {
- // src is at EOF, which means we are done.
+ // 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
+ if written == 0 {
+ return 0, false, nil
+ }
+ // Otherwise src is at EOF, which means
+ // we are done.
return written, true, nil
}
remain -= n