diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 168e8c040aab1c958fa72eba8ae1170316c9a823..da76cad92ecf385e7202d823c3d50463307d05fa 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -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