aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-08-12 12:09:35 -0700
committerDmitri Shuralyov <dmitshur@golang.org>2020-08-21 23:20:23 +0000
commitf2b710998902d6754d62810e1577c01313763342 (patch)
tree10fcf0ee363b4e908d64cde2edca5c192b01b491
parent9c17883f28ceb2aba94ae7f51269f1c982fd7f8b (diff)
downloadgo-f2b710998902d6754d62810e1577c01313763342.tar.gz
go-f2b710998902d6754d62810e1577c01313763342.zip
[release-branch.go1.15] internal/poll: treat copy_file_range EOPNOTSUPP as not-handled
For #40731 Fixes #40739 Change-Id: I3e29878d597318acf5edcc38497aa2624f72be35 Reviewed-on: https://go-review.googlesource.com/c/go/+/248258 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> (cherry picked from commit d3a411b6debccb665da3497e7fa597c9a5ff16f1) Reviewed-on: https://go-review.googlesource.com/c/go/+/249197 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
-rw-r--r--src/internal/poll/copy_file_range_linux.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/internal/poll/copy_file_range_linux.go b/src/internal/poll/copy_file_range_linux.go
index 604607f774..7e67125818 100644
--- a/src/internal/poll/copy_file_range_linux.go
+++ b/src/internal/poll/copy_file_range_linux.go
@@ -41,7 +41,7 @@ func CopyFileRange(dst, src *FD, remain int64) (written int64, handled bool, err
// use copy_file_range(2) again.
atomic.StoreInt32(&copyFileRangeSupported, 0)
return 0, false, nil
- case syscall.EXDEV, syscall.EINVAL:
+ case syscall.EXDEV, syscall.EINVAL, syscall.EOPNOTSUPP:
// Prior to Linux 5.3, it was not possible to
// copy_file_range across file systems. Similarly to
// the ENOSYS case above, if we see EXDEV, we have
@@ -52,6 +52,9 @@ func CopyFileRange(dst, src *FD, remain int64) (written int64, handled bool, err
// dst or src refer to a pipe rather than a regular
// file. This is another case where no data has been
// transfered, so we consider it unhandled.
+ //
+ // If the file is on NFS, we can see EOPNOTSUPP.
+ // See issue #40731.
return 0, false, nil
case nil:
if n == 0 {