Skip to content

Commit

Permalink
btrfs: Don't BUG_ON errors from btrfs_create_subvol_root()
Browse files Browse the repository at this point in the history
This is called from only one place - create_subvol() which passes errors
safely back out to it's caller, btrfs_mksubvol where they are handled.

Additionally, btrfs_create_subvol_root() itself bug's needlessly from error
return of btrfs_update_inode(). Since create_subvol() was fixed to catch
errors we can bubble this one up too.

Signed-off-by: Mark Fasheh <mfasheh@suse.com>
  • Loading branch information
Mark Fasheh authored and David Sterba committed Mar 22, 2012
1 parent 2c53679 commit ce59897
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -6734,10 +6734,9 @@ int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
btrfs_i_size_write(inode, 0);

err = btrfs_update_inode(trans, new_root, inode);
BUG_ON(err);

iput(inode);
return 0;
return err;
}

struct inode *btrfs_alloc_inode(struct super_block *sb)
Expand Down
5 changes: 5 additions & 0 deletions fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,11 @@ static noinline int create_subvol(struct btrfs_root *root,
btrfs_record_root_in_trans(trans, new_root);

ret = btrfs_create_subvol_root(trans, new_root, new_dirid);
if (ret) {
/* We potentially lose an unused inode item here */
goto fail;
}

/*
* insert the directory item
*/
Expand Down

0 comments on commit ce59897

Please sign in to comment.