diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2020-08-19 16:54:36 +0200 |
---|---|---|
committer | Dmitri Shuralyov <dmitshur@golang.org> | 2020-08-22 01:21:29 +0000 |
commit | 8bf83b323cb5542ac3c41394a4bb1d3ae115c640 (patch) | |
tree | 327c8d0e597ea3c1ae904fc54ecd20921eb9b5bd | |
parent | f454f70344703bd08e1f0a104fd2e6879e1d846c (diff) | |
download | go-8bf83b323cb5542ac3c41394a4bb1d3ae115c640.tar.gz go-8bf83b323cb5542ac3c41394a4bb1d3ae115c640.zip |
[release-branch.go1.15] internal/poll: treat copy_file_range EPERM as not-handled
Updates #40893.
Fixes #40900.
Change-Id: I938ea4796c1e1d1e136117fe78b06ad6da8e40de
Reviewed-on: https://go-review.googlesource.com/c/go/+/249257
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Antonio Troina <thoeni@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit b0cc02e8c2bdba5401838d9d70a859191af9bfa5)
Reviewed-on: https://go-review.googlesource.com/c/go/+/249897
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
-rw-r--r-- | src/internal/poll/copy_file_range_linux.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/internal/poll/copy_file_range_linux.go b/src/internal/poll/copy_file_range_linux.go index 7e67125818..09de299ff7 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(©FileRangeSupported, 0) return 0, false, nil - case syscall.EXDEV, syscall.EINVAL, syscall.EOPNOTSUPP: + case syscall.EXDEV, syscall.EINVAL, syscall.EOPNOTSUPP, syscall.EPERM: // 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 @@ -55,6 +55,11 @@ func CopyFileRange(dst, src *FD, remain int64) (written int64, handled bool, err // // If the file is on NFS, we can see EOPNOTSUPP. // See issue #40731. + // + // If the process is running inside a Docker container, + // we might see EPERM instead of ENOSYS. See issue + // #40893. Since EPERM might also be a legitimate error, + // don't mark copy_file_range(2) as unsupported. return 0, false, nil case nil: if n == 0 { |