Skip to content

Commit b0cc02e

Browse files
committed
internal/poll: treat copy_file_range EPERM as not-handled
Fixes #40893 Change-Id: I938ea4796c1e1d1e136117fe78b06ad6da8e40de Reviewed-on: https://go-review.googlesource.com/c/go/+/249257 Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Antonio Troina <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 2d34f3d commit b0cc02e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/internal/poll/copy_file_range_linux.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func CopyFileRange(dst, src *FD, remain int64) (written int64, handled bool, err
4141
// use copy_file_range(2) again.
4242
atomic.StoreInt32(&copyFileRangeSupported, 0)
4343
return 0, false, nil
44-
case syscall.EXDEV, syscall.EINVAL, syscall.EOPNOTSUPP:
44+
case syscall.EXDEV, syscall.EINVAL, syscall.EOPNOTSUPP, syscall.EPERM:
4545
// Prior to Linux 5.3, it was not possible to
4646
// copy_file_range across file systems. Similarly to
4747
// 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
5555
//
5656
// If the file is on NFS, we can see EOPNOTSUPP.
5757
// See issue #40731.
58+
//
59+
// If the process is running inside a Docker container,
60+
// we might see EPERM instead of ENOSYS. See issue
61+
// #40893. Since EPERM might also be a legitimate error,
62+
// don't mark copy_file_range(2) as unsupported.
5863
return 0, false, nil
5964
case nil:
6065
if n == 0 {

0 commit comments

Comments
 (0)