diff options
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 657d83ca9dea..d4608ab72b79 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -710,6 +710,16 @@ static noinline int btrfs_mksubvol(struct path *parent, | |||
710 | if (error) | 710 | if (error) |
711 | goto out_dput; | 711 | goto out_dput; |
712 | 712 | ||
713 | /* | ||
714 | * even if this name doesn't exist, we may get hash collisions. | ||
715 | * check for them now when we can safely fail | ||
716 | */ | ||
717 | error = btrfs_check_dir_item_collision(BTRFS_I(dir)->root, | ||
718 | dir->i_ino, name, | ||
719 | namelen); | ||
720 | if (error) | ||
721 | goto out_dput; | ||
722 | |||
713 | down_read(&BTRFS_I(dir)->root->fs_info->subvol_sem); | 723 | down_read(&BTRFS_I(dir)->root->fs_info->subvol_sem); |
714 | 724 | ||
715 | if (btrfs_root_refs(&BTRFS_I(dir)->root->root_item) == 0) | 725 | if (btrfs_root_refs(&BTRFS_I(dir)->root->root_item) == 0) |