Skip to contentSkip to conversation

why check f_path.mnt is equal for source and dest in btrfs_ioctl_clone()?

DISCUSSION Stefan Paletta 2 participants 2 messages Jun 30, 2013 – Jul 1, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

This gives EXDEV for clone operations that btrfs could otherwise execute and with slight change of circumstances will actually execute fine.

Imagine we have a btrfs on /dev/mapper/foobar with subvols /foo and /bar. Let’s also imagine top of said fs in mounted at /mnt. In this case, a cross-subvol clone of /mnt/foo/srcfile to /mnt/bar/dstfile will succeed.

However, if only the individual subvols were mounted like this:
/dev/mapper/foobar on /mnt (subvol=foo)
/dev/mapper/foobar on /mnt2 (subvol=bar),
then a clone of /mnt/srcfile to /mnt2/dstfile will fail with EXDEV even though it is otherwise equal to the former clone operation.

Would anyone care to shed some light on this? Is it due to legacy policy? Am I missing something?

Thanks
–Stefan

#1 lore raw
Quoted 6 lines · Stefan Paletta

This gives EXDEV for clone operations that btrfs could otherwise execute and with slight change of circumstances will actually execute fine.

Imagine we have a btrfs on /dev/mapper/foobar with subvols /foo and /bar. Let’s also imagine top of said fs in mounted at /mnt. In this case, a cross-subvol clone of /mnt/foo/srcfile to /mnt/bar/dstfile will succeed.

This does not cross a mountpoint.

Quoted 5 lines

However, if only the individual subvols were mounted like this:
/dev/mapper/foobar on /mnt (subvol=foo) /dev/mapper/foobar on /mnt2 (subvol=bar),
then a clone of /mnt/srcfile to /mnt2/dstfile will fail with EXDEV even though it is otherwise equal to the former clone operation.

And this does. This is prevented for the same reason hadlinks do not work accross mountpoints when the same filesytem is mounted multiple times.

Quoted 2 lines

Would anyone care to shed some light on this? Is it due to legacy policy? Am I missing something?

http://thread.gmane.org/gmane.comp.file-systems.btrfs/9867

Although it's more about reflink/clone spanning subvolumes regardless of the mountpoints, there's an objection against file operations performed accross vfsmounts and current implementation respects that.

david