-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
COW cp (--reflink) doesn't work across different datasets: Invalid cross-device link #15345
Comments
@rincebrain interesting, but somehow it doesn't work according to the |
This is not an OpenZFS bug as such, because if Linux would pass the call down, we would quite happily service it. Working around Linux's check here is extremely difficult, if its even possible. (the Btrfs example is not really relevant; OpenZFS and Btrfs have a fundamentally different construction and purpose).
The call time is not a very good indicator that a clone vs a copy was done. To tell if it was cloned you currently have to dig around with Yes, this sucks. We'll keep working on it but its complicated. |
btrfs doesn't trip this because they show up subvolumes as the same "mountpoint" which is why this check doesn't bite them. |
The problem is not only with different datasets, but with snapshots as well:
Accessing snapshots create a different mountpoint which triggers the same issue. |
Filesystems and snapshots are different datasets. Or, put another way, they're different mounts, and so different superblocks, and so Linux rejects the request. I understand that this is frustrating, but no amount of pointing it out is going to make a quick fix happen. I'm aware of four possible solutions (or shapes of solutions):
I've been quietly exploring all of these options for a few weeks now. They are all difficult and/or complicated, for different reasons, and I also have very little time available to look at it. If you've got some other idea, I'm happy to hear it. |
My only suggestion is to reach Kent Overstreet @koverstreet and ask him what are his plans for bcachefs regarding this. |
The reason why |
If you're going to take something I wrote and pass it off as your own you should at least adjust it to match the context. That's why it didn't work in your case. It can and does create clones in many other situations. In any case, there's no bug here. These limitations are well understood and will be worked on as time and interest allows. |
That was not my intention and I'm sorry if it felt that way. I'm just trying my best to juggle the relevant information across the two threads so that anybody who stumbles upon either of them will understand what's going on.
I thought that was clear enough, but I've edited my past message to change "does" with "might". |
I think getting a patch into the linux kernel to lift the cross device link restriction can be pretty hard. There is no usecase in the kernel and no kernel (fs)driver wich need this. I don't think that the linux kernel will accept for example a new ioctl-flag |
Unfortunately even bcachefs won't be a suitable candide because it already supports reflinking across different subvolumes. |
@darkbasic Perhaps, but regardless, Kent's very smart and knowledgeable and I think nice enough to give some objective and thoughtful opinions that may be helpful. |
From the user point of view, it makes lots of sense, like reorganizing data (files) between datasets. |
I did write to him and I linked this issue, but he simply replied that bcachefs can already reflink between subvolumes.
Definitely. |
Personally, I'd be ok with FWIW - I'm just glad that this now exists (think large VM base/fluid type images), even if there are some barriers preventing it from full (envisioned) functionality. |
@darkbasic Yea, I read some of the Linux kernel dev emails and noticed many jumping on Kent as he was trying to get bcachefs upstream, seemed very "tense and stressful" for him. (skipping linking painful emails) Interesting quote from Kent: Anyway, was really great to see we got a Halloween "present" and looks like Bcachefs was finally merged into the 6.7 kernel by Linus at the end of October! Have any parts of ZFS gotten "rusty" at all over the years?? ( https://lwn.net/Articles/934692/ ) |
+1 FWIW I have a use case re: httm. I implemented FICLONE for
+1 Not that I deserve an opinion re: implementation, but I think a new subcommand/arg |
@darkbasic I'm seeing the same on Ubuntu with coreutils 9.1 installed, |
Coreutils should have an |
For some reason the |
From trying to copy a 1GiB file:
Seems to me that would indicate there is no hole in the source file, so why does |
Newer |
You don't use native encryption, right? Otherwise I'm a little bit puzzled because it's not supposed to work with encryption. P.S. You should disable block cloning altogether until things get figured out because of corruption reports on Gentoo. |
No encryption but LZ4 compression. I mean reflinking works if I pass the right options, it is the sparse detection that seems to fail in coreutils 9.1. I created the source file using I know about the data corruption issue, thanks. |
Does anyone have an issue number for those of us who don't? |
Here it is: #15526 |
I think
or
|
System information
Describe the problem you're observing
Reflinking doesn't work across different datasets.
Since https://lore.kernel.org/linux-btrfs/[email protected]/T/#mf251325026fe2e15ed5119856bf654ba4f0d298b btrfs allows to reflink across different subvolumes, so it should be possible to achieve something similar in Linux with zfs.
Not being able to reflink across different datasets vastly reduce the utility of reflinking.
Describe how to reproduce the problem
cp -a --reflink=always /path/to/first/dataset/file /path/to/second/dataset/
Include any warning/errors/backtraces from the system logs
P.S.
I have been told that
--reflink=auto
should be able to clone blocks across different datasets, but this isn't the case:It took 3 seconds compared to 0.1 seconds when the dataset was the same, suggesting that reflinking didn't work across datasets.
The text was updated successfully, but these errors were encountered: