diff mbox

Deny sys_link across subvolumes.

Message ID 4AFBB5D2.3060405@jp.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

TARUISI Hiroaki Nov. 12, 2009, 7:14 a.m. UTC
None
diff mbox

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 78139ef..c7f66e4 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4284,6 +4284,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