[lkml]   [2010]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[057/111] Btrfs: deny sys_link across subvolumes.
2.6.32-stable review patch.  If anyone has any objections, please let us know.


From: TARUISI Hiroaki <>

commit 4a8be425a8fb8fbb5d881eb55fa6634c3463b9c9 upstream.

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 <>
Signed-off-by: Chris Mason <>
Acked-by: Jeff Mahoney <>
Signed-off-by: Greg Kroah-Hartman <>

fs/btrfs/inode.c | 4 ++++
1 file changed, 4 insertions(+)

--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4462,6 +4462,10 @@ static int btrfs_link(struct dentry *old
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

 \ /
  Last update: 2010-08-12 02:35    [W:0.242 / U:0.676 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site