Btrfs: deny sys_link across subvolumes.
[cascardo/linux.git] / fs / btrfs / inode.c
index 168e8c0..da76cad 100644 (file)
@@ -4462,6 +4462,10 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
        if (inode->i_nlink == 0)
                return -ENOENT;
 
+       /* do not allow sys_link's with other subvols of the same device */
+       if (root->objectid != BTRFS_I(inode)->root->objectid)
+               return -EPERM;
+
        /*
         * 1 item for inode ref
         * 2 items for dir items