Re: Cross-subvolume link causes kernel BUG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

   > ln segfaults, and the bug above is found in dmesg.  Subsequent
   > accesses to the subvolume result in a D state hung process.  Full
   > dmesg follows.  I first observed this on a Gentoo system and
   > reproduced it on Ubuntu.  Both were running unpatched 2.6.32.9
   > kernels.

I think this is fixed in 2.6.33, as a result of the patch below.
Let us know if you see a segfault on 2.6.33, or after applying this
patch to your current kernel.

Thanks,

- Chris.

commit 4a8be425a8fb8fbb5d881eb55fa6634c3463b9c9
Author: TARUISI Hiroaki <taruishi.hiroak@xxxxxxxxxxxxxx>
Date:   Thu Nov 12 07:14:26 2009 +0000

    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@xxxxxxxxxxxxxx>
    Signed-off-by: Chris Mason <chris.mason@xxxxxxxxxx>

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 168e8c0..da76cad 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

-- 
Chris Ball   <cjb@xxxxxxxxxx>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux