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

BRT: cross-dataset block cloning fails with EXDEV on Linux 6.11 #16837

Closed
intelfx opened this issue Dec 4, 2024 · 4 comments
Closed

BRT: cross-dataset block cloning fails with EXDEV on Linux 6.11 #16837

intelfx opened this issue Dec 4, 2024 · 4 comments
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@intelfx
Copy link

intelfx commented Dec 4, 2024

System information

Type Version/Name
Distribution Name Arch
Distribution Version current
Kernel Version 6.11.10
Architecture x86_64
OpenZFS Version 2.3.0-rc3

Describe the problem you're observing

Similarly to concerns from #405 (#405 (comment)), attempting to do a cp --reflink=always between two sibling datasets fails with EXDEV. However, unlike that case, no encryption is used.

Describe how to reproduce the problem

# ccat /sys/module/zfs/parameters/*clone*
/sys/module/zfs/parameters/zfs_bclone_enabled     1
/sys/module/zfs/parameters/zfs_bclone_wait_dirty  1

# modprobe brd rd_nr=1 rd_size=$(bscalcq -k '50G')

# CFG_ZPOOL_CREATE_OPTS=(
        -o ashift=12
        -o feature@block_cloning=enabled
        -O compression=lz4
        -O acltype=posixacl -O xattr=sa -O dnodesize=auto
)
# zpool create "${CFG_ZPOOL_CREATE_OPTS[@]}" test /dev/ram0
# parallel zfs create -p ::: test/ROOT/test{1,2,3,4}
# parallel "dd if=/dev/urandom of=/test/ROOT/test{}/file{} bs=1M count=1024" ::: 1 2 3 4
# zpool sync test

# cp -a --reflink=always /test/ROOT/test2/file2 /test/ROOT/test4/file4
/usr/bin/cp: failed to clone '/test/ROOT/test4/file4' from '/test/ROOT/test2/file2': Invalid cross-device link
@intelfx intelfx added the Type: Defect Incorrect behavior (e.g. crash, hang) label Dec 4, 2024
@intelfx intelfx changed the title BRT: cross-dataset block cloning does not work on Linux 6.11 BRT: cross-dataset block cloning fails with EXDEV on Linux 6.11 Dec 4, 2024
@amotin
Copy link
Member

amotin commented Dec 4, 2024

@intelfx Could you similar to quoted post run strace on the cp to make sure what syscall fails there? Just to make sure it uses copy_file_range(), since other system calls have that limitation on kernel level.

@intelfx
Copy link
Author

intelfx commented Dec 4, 2024

@amotin

Yep, it uses FICLONE (which fails), presumably because I said --reflink=always and it is not possible to guarantee with copy_file_range() that the blocks were cloned rather than just copied in-kernel.

I'm assuming zfs uses a different struct super_block for each dataset, and consequently runs afoul of the same-sb check in the generic FICLONE implementation?

@snajpa
Copy link
Contributor

snajpa commented Dec 4, 2024

AFAIK this isn't supported (due to the reason @intelfx outlies) so I'd say it's more of a Feature request than a Defect (how can one change it?)

@robn
Copy link
Member

robn commented Dec 4, 2024

@intelfx yes, this is the reason.

Duplicate of #15345.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

No branches or pull requests

4 participants