Btrfs: detect duplicate subvol names
authorChris Mason <chris.mason@oracle.com>
Wed, 11 Apr 2007 00:07:20 +0000 (20:07 -0400)
committerDavid Woodhouse <dwmw2@hera.kernel.org>
Wed, 11 Apr 2007 00:07:20 +0000 (20:07 -0400)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/super.c

index 84abdde4e301cdbaec1a135016a201746cbdab71..2972aaa9eb7e60dcf63339d8bbcae8dd3baf551e 100644 (file)
@@ -1853,13 +1853,13 @@ static int btrfs_ioctl(struct inode *inode, struct file *filp, unsigned int
                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;