Re: [PATCH 2/5] btrfs: don't BUG_ON in create_subvol

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

 



On Fri, Dec 6, 2019 at 2:38 PM Josef Bacik <josef@xxxxxxxxxxxxxx> wrote:
>
> We can just abort the transaction here, and in fact do that for every
> other failure in this function except these two cases.
>
> Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>

Reviewed-by: Filipe Manana <fdmanana@xxxxxxxx>

Looks good, thanks.

> ---
>  fs/btrfs/ioctl.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index a1ee0b775e65..375befdecc19 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -704,11 +704,17 @@ static noinline int create_subvol(struct inode *dir,
>
>         btrfs_i_size_write(BTRFS_I(dir), dir->i_size + namelen * 2);
>         ret = btrfs_update_inode(trans, root, dir);
> -       BUG_ON(ret);
> +       if (ret) {
> +               btrfs_abort_transaction(trans, ret);
> +               goto fail;
> +       }
>
>         ret = btrfs_add_root_ref(trans, objectid, root->root_key.objectid,
>                                  btrfs_ino(BTRFS_I(dir)), index, name, namelen);
> -       BUG_ON(ret);
> +       if (ret) {
> +               btrfs_abort_transaction(trans, ret);
> +               goto fail;
> +       }
>
>         ret = btrfs_uuid_tree_add(trans, root_item->uuid,
>                                   BTRFS_UUID_KEY_SUBVOL, objectid);
> --
> 2.23.0
>


-- 
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”




[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