aboutsummaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2021-02-16 16:18:18 -0500
committerCherry Zhang <cherryyz@google.com>2021-02-16 16:18:19 -0500
commit03cea563d156736a916137d0f68a14dc86c552a0 (patch)
tree0d12c5f6ff0f08adffbfc38c283f606deb474318 /src/internal
parentb8fb049c7ad4940901613d16629a88b38c6a82da (diff)
parent5faf941df067b33485edb9cd2e880869e7feb6a3 (diff)
downloadgo-03cea563d156736a916137d0f68a14dc86c552a0.tar.gz
go-03cea563d156736a916137d0f68a14dc86c552a0.zip
[dev.regabi] all: merge master (5faf941) into dev.regabi
Merge List: + 2021-02-16 5faf941df0 internal/goversion: update Version to 1.17 + 2021-02-16 6f3da9d2f6 README: pull gopher image from website + 2021-02-16 098504c73f cmd/link: generate trampoline for inter-dependent packages + 2021-02-16 1004a7cb31 runtime/metrics: update documentation to current interface + 2021-02-16 6530f2617f doc/go1.16: remove draft notice + 2021-02-16 353e111455 doc/go1.16: fix mismatched id attribute + 2021-02-16 f0d23c9dbb internal/poll: netpollcheckerr before sendfile + 2021-02-16 0cb3415154 doc: remove all docs not tied to distribution + 2021-02-16 626ef08127 doc: remove install.html and install-source.html + 2021-02-16 30641e36aa internal/poll: if copy_file_range returns 0, assume it failed + 2021-02-15 33d72fd412 doc/faq: update generics entry to reflect accepted proposal + 2021-02-15 852ce7c212 cmd/go: provide a more helpful suggestion for "go vet -?" + 2021-02-13 66c27093d0 cmd/link: fix typo in link_test.go Change-Id: I98f047b79b93c5ceb344dd43408bcb919b23aeb3
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/goversion/goversion.go2
-rw-r--r--src/internal/poll/copy_file_range_linux.go10
-rw-r--r--src/internal/poll/sendfile_bsd.go4
-rw-r--r--src/internal/poll/sendfile_linux.go3
-rw-r--r--src/internal/poll/sendfile_solaris.go3
5 files changed, 20 insertions, 2 deletions
diff --git a/src/internal/goversion/goversion.go b/src/internal/goversion/goversion.go
index 513be456bd..4cc15688c0 100644
--- a/src/internal/goversion/goversion.go
+++ b/src/internal/goversion/goversion.go
@@ -9,4 +9,4 @@ package goversion
//
// It should be updated at the start of each development cycle to be
// the version of the next Go 1.x release. See golang.org/issue/40705.
-const Version = 16
+const Version = 17
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
diff --git a/src/internal/poll/sendfile_bsd.go b/src/internal/poll/sendfile_bsd.go
index a24e41dcaa..66005a9f5c 100644
--- a/src/internal/poll/sendfile_bsd.go
+++ b/src/internal/poll/sendfile_bsd.go
@@ -18,6 +18,10 @@ func SendFile(dstFD *FD, src int, pos, remain int64) (int64, error) {
return 0, err
}
defer dstFD.writeUnlock()
+ if err := dstFD.pd.prepareWrite(dstFD.isFile); err != nil {
+ return 0, err
+ }
+
dst := int(dstFD.Sysfd)
var written int64
var err error
diff --git a/src/internal/poll/sendfile_linux.go b/src/internal/poll/sendfile_linux.go
index d64283007d..d6442e8666 100644
--- a/src/internal/poll/sendfile_linux.go
+++ b/src/internal/poll/sendfile_linux.go
@@ -16,6 +16,9 @@ func SendFile(dstFD *FD, src int, remain int64) (int64, error) {
return 0, err
}
defer dstFD.writeUnlock()
+ if err := dstFD.pd.prepareWrite(dstFD.isFile); err != nil {
+ return 0, err
+ }
dst := int(dstFD.Sysfd)
var written int64
diff --git a/src/internal/poll/sendfile_solaris.go b/src/internal/poll/sendfile_solaris.go
index 762992e9eb..748c85131e 100644
--- a/src/internal/poll/sendfile_solaris.go
+++ b/src/internal/poll/sendfile_solaris.go
@@ -20,6 +20,9 @@ func SendFile(dstFD *FD, src int, pos, remain int64) (int64, error) {
return 0, err
}
defer dstFD.writeUnlock()
+ if err := dstFD.pd.prepareWrite(dstFD.isFile); err != nil {
+ return 0, err
+ }
dst := int(dstFD.Sysfd)
var written int64