From: Josef Bacik Date: Wed, 9 Oct 2013 16:24:04 +0000 (-0400) Subject: Btrfs: use right root when checking for hash collision X-Git-Tag: firefly_0821_release~6453^2~530 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a849b2f4200ab490d7a6d80e7632d28dc80c8f6f;p=firefly-linux-kernel-4.4.55.git Btrfs: use right root when checking for hash collision commit 4871c1588f92c6c13f4713a7009f25f217055807 upstream. btrfs_rename was using the root of the old dir instead of the root of the new dir when checking for a hash collision, so if you tried to move a file into a subvol it would freak out because it would see the file you are trying to move in its current root. This fixes the bug where this would fail btrfs subvol create test1 btrfs subvol create test2 mv test1 test2. Thanks to Chris Murphy for catching this, Reported-by: Chris Murphy Signed-off-by: Josef Bacik Signed-off-by: Chris Mason Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 17f3064b4a3e..1e2288dc5346 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8146,7 +8146,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, /* check for collisions, even if the name isn't there */ - ret = btrfs_check_dir_item_collision(root, new_dir->i_ino, + ret = btrfs_check_dir_item_collision(dest, new_dir->i_ino, new_dentry->d_name.name, new_dentry->d_name.len);