os: if rename system call fails, try ioctl(FICLONE) #41487
Comments
|
Thanks for your quick response @ianlancetaylor. To test, I made an empty file,
I'm waaaay out of my depth here, but I'm guessing these lines are the important ones:
It looks like the |
Interesting. I was not aware of that. I'll retitle this issue. |
I've tried to follow the source for Ultimately, it appears to all be controlled by the defaulting of the following two flags in |
It's interesting that BTRFS reports those two directories as being on different filesystems, but is then happy to do a CoW! |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I am cross-compiling on Mac for Linux
Linux execution env:
Linux nas 4.4.190.x86_64.1 #1 SMP Mon Oct 28 01:55:46 UTC 2019 x86_64 GNU/Linux
Build command:
GOOS=linux GOARCH=amd64 go build -v
What did you expect to see?
os.Rename()
to succeed because the source and target are on the same filesystem.What did you see instead?
os.Rename()
returns "invalid cross-device link" and the above code falls back to copy-and-delete. If I do anmv
on the command line, it completes immediately - even for multi-gigabyte files.The text was updated successfully, but these errors were encountered: