Btrfs: detect duplicate subvol names
Signed-off-by: Chris Mason <chris.mason@oracle.com>
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 84abdde..2972aaa 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1853,13 +1853,13 @@
path = btrfs_alloc_path();
if (!path)
return -ENOMEM;
- root_dirid = btrfs_root_dirid(
- &root->fs_info->tree_root->root_item);
+ root_dirid = root->fs_info->sb->s_root->d_inode->i_ino,
mutex_lock(&root->fs_info->fs_mutex);
ret = btrfs_lookup_dir_item(NULL, root->fs_info->tree_root,
path, root_dirid,
vol_args.name, namelen, 0);
mutex_unlock(&root->fs_info->fs_mutex);
+ btrfs_free_path(path);
if (ret == 0)
return -EEXIST;