On Tue, May 01, 2012 at 07:09:21PM +0200, Hubert Kario wrote:
> Let me rephrase it:
> 
> People don't want to be able to do:
> 
> mount /dev/lvm/btrfs /mnt/a -t btrfs -o subvol=volA
> mount /dev/lvm/btrfs /mnt/b -t btrfs -o subvol=volB
> cp --reflink=always /mnt/a/file /mnt/b
> 
> Just like you can't do hardlinks over `mount --bind` mountpoints, you 
> shouldn't be able to cp reflink over mountpoints. That's expected as this 
> *does* break VFS semantics.

Proposed fix (incremental on top of the cross-subvol):

--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2321,6 +2321,10 @@ static noinline long btrfs_ioctl_clone(struct file 
*file, unsigned long srcfd,
                goto out_drop_write;
        }

+       ret = -EXDEV;
+       if (src_file->f_path.mnt != file->f_path.mnt)
+               goto out_fput;
+
        src = src_file->f_dentry->d_inode;

        ret = -EINVAL;


david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to