Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal/poll: CopyFileRange returns EIO on CentOS 7 ( Linux Kernel 3.10.0-1127) when io.Copy in mounted CIFS #42334

Closed
meiyang1123 opened this issue Nov 2, 2020 · 7 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-Linux
Milestone

Comments

@meiyang1123
Copy link

What version of Go are you using (go version)?

$ go version

go version go1.15.3 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/go/path/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go/path"
GOPRIVATE=""
GOPROXY="https://goproxy.io"
GOROOT="/go/root/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/go/root/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/code/goldeneyes/common/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build111842700=/tmp/go-build -gno-record-gcc-switches"

run at CentOS Linux release 7.8.2003 (Kernel 3.10.0-1127.el7.x86_64)

What did you do?

I set up a samba service , share a directory, allow user to read and create and write.

Then, mount the share directory at CentOS 7 /mnt/test

build a example:

func main() {
	fmt.Println(CopyFile(os.Args[1], os.Args[2]))
}

func CopyFile(src string, dst string) (int64, error) {
	srcFile, err := os.Open(src)
	if err != nil {
		return -1, err
	}
	defer srcFile.Close()

	dstFile, err := os.OpenFile(dst, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.ModePerm)
	if err != nil {
		return -1, err
	}
	defer dstFile.Close()
	return io.Copy(dstFile, srcFile)
}

go build -o gocopy
Run gocopy on CentOS7 :

[root@localhost ~]# ./gocopy 1.txt 2.txt
18 <nil>
[root@localhost ~]# ./gocopy /mnt/test/1.txt 1.txt
18 <nil>
[root@localhost ~]# ./gocopy 1.txt /mnt/test/2.txt
18 <nil>
[root@localhost ~]# ./gocopy /mnt/test/1.txt /mnt/test/2.txt
0 write /mnt/test/2.txt: copy_file_range: input/output error

Follow the source code,found:

On success case, copyFileRange return ENOSYS . But when copy two file on cifs will return EIO

What did you expect to see?

copy success

@meiyang1123 meiyang1123 changed the title nternal/poll: CopyFileRange returns EIO on CentOS 7 ( Linux Kernel 3.10.0-1127) when io.Copy in mounted cifs internal/poll: CopyFileRange returns EIO on CentOS 7 ( Linux Kernel 3.10.0-1127) when io.Copy in mounted cifs Nov 2, 2020
@meiyang1123 meiyang1123 changed the title internal/poll: CopyFileRange returns EIO on CentOS 7 ( Linux Kernel 3.10.0-1127) when io.Copy in mounted cifs internal/poll: CopyFileRange returns EIO on CentOS 7 ( Linux Kernel 3.10.0-1127) when io.Copy in mounted CIFS Nov 2, 2020
@tklauser tklauser added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Linux labels Nov 2, 2020
@tklauser
Copy link
Member

tklauser commented Nov 2, 2020

Thanks for the report @meiyang1123.

Previously: #40893, #40731. I think the fix should be similar, i.e. we should handle syscall.EIO like we already do for syscall.EXDEV, syscall.EINVAL, syscall.EOPNOTSUPP, syscall.EPERM.

Given that the previous two issues were backported, I assume we should backport a fix for this to 1.15 as well?

/cc @ianlancetaylor

@tklauser tklauser added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 2, 2020
@gopherbot
Copy link

Change https://golang.org/cl/266940 mentions this issue: internal/poll: treat copy_file_range EIO as not-handled

@tklauser
Copy link
Member

tklauser commented Nov 2, 2020

@meiyang1123 Could you check that https://golang.org/cl/266940 fixes the issue for you? Thanks.

@meiyang1123
Copy link
Author

@meiyang1123 Could you check that https://golang.org/cl/266940 fixes the issue for you? Thanks.

Yes ,It works for me.

@ianlancetaylor
Copy link
Contributor

@gopherbot Please open backport issues for 1.15.

This is an unlikely error, but if it occurs there is no workaround.

@gopherbot
Copy link

Backport issue(s) opened: #42369 (for 1.15).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

@gopherbot
Copy link

Change https://golang.org/cl/267917 mentions this issue: [release-branch.go1.15] internal/poll: treat copy_file_range EIO as not-handled

gopherbot pushed a commit that referenced this issue Nov 6, 2020
…ot-handled

For #42334
Fixes #42369

Change-Id: Ife51df4e7d2539a04393abfdec45e3f902975fca
Reviewed-on: https://go-review.googlesource.com/c/go/+/266940
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 633f9e2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/267917
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
@golang golang locked and limited conversation to collaborators Nov 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-Linux
Projects
None yet
Development

No branches or pull requests

6 participants
@tklauser @dmitshur @ianlancetaylor @gopherbot @meiyang1123 and others