]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.15] internal/poll: use copy_file_range only on Linux kernel ...
authorTobias Klauser <tklauser@distanz.ch>
Mon, 9 Nov 2020 10:25:38 +0000 (11:25 +0100)
committerDmitri Shuralyov <dmitshur@golang.org>
Fri, 20 Nov 2020 21:54:27 +0000 (21:54 +0000)
commit20f50bba49e6338793a5711dc1c6ed60e4b10df8
tree9840852e4e7783d567492fc51ca507aca18df968
parentefd204ccf78e16ee6792079ba70456ed425cb9c3
[release-branch.go1.15] internal/poll: use copy_file_range only on Linux kernel >= 5.3

https://man7.org/linux/man-pages/man2/copy_file_range.2.html#VERSIONS states:

  A major rework of the kernel implementation occurred in 5.3.  Areas
  of the API that weren't clearly defined were clarified and the API
  bounds are much more strictly checked than on earlier kernels.
  Applications should target the behaviour and requirements of 5.3
  kernels.

Rather than attempting to detect the file system for source and
destination files (which means two additional statfs syscalls) and skip
copy_file_range in case of known defects (e.g. CIFS -> CIFS), just
assume copy_file_range to be broken on kernels < 5.3.

Fixes #42550

Change-Id: I3a531296182c1d6e341772cc9d2be5bf83e52575
Reviewed-on: https://go-review.googlesource.com/c/go/+/268338
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 1c7650aa93bd53b7df0bbb34693fc5a16d9f67af)
Reviewed-on: https://go-review.googlesource.com/c/go/+/269759
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
src/internal/poll/copy_file_range_linux.go