aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorTARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com>2009-11-12 02:14:26 -0500
committerChris Mason <chris.mason@oracle.com>2009-12-17 12:33:37 -0500
commit4a8be425a8fb8fbb5d881eb55fa6634c3463b9c9 (patch)
treec89e0aa1aac790d77f6a29a4bc48384922152d00 /fs/btrfs/inode.c
parenta7a3f7cadd9bdee569243f7ead9550aa16b60e07 (diff)
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: TARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 168e8c040aab..da76cad92ecf 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,
4462 if (inode->i_nlink == 0) 4462 if (inode->i_nlink == 0)
4463 return -ENOENT; 4463 return -ENOENT;
4464 4464
4465 /* do not allow sys_link's with other subvols of the same device */
4466 if (root->objectid != BTRFS_I(inode)->root->objectid)
4467 return -EPERM;
4468
4465 /* 4469 /*
4466 * 1 item for inode ref 4470 * 1 item for inode ref
4467 * 2 items for dir items 4471 * 2 items for dir items