Skip to content
Snippets Groups Projects
Commit 4a8be425 authored by TARUISI Hiroaki's avatar TARUISI Hiroaki Committed by Chris Mason
Browse files

Btrfs: deny sys_link across subvolumes.


I rebased Christian Parpart's patch to deny hard link across
subvolumes. Original patch modifies also btrfs_rename, but
I excluded it because we can move across subvolumes now and
it make no problem.
-----------------

Hard link across subvolumes should not allowed in Btrfs.
btrfs_link checks root of 'to' directory is same as root
of 'from' file. If not same, btrfs_link returns -EPERM.

Signed-off-by: default avatarTARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent a7a3f7ca
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment