提交 ce598979 编写于 作者: M Mark Fasheh 提交者: David Sterba

btrfs: Don't BUG_ON errors from btrfs_create_subvol_root()

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: NMark Fasheh <mfasheh@suse.com>
上级 2c536799
...@@ -6734,10 +6734,9 @@ int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, ...@@ -6734,10 +6734,9 @@ int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
btrfs_i_size_write(inode, 0); btrfs_i_size_write(inode, 0);
err = btrfs_update_inode(trans, new_root, inode); err = btrfs_update_inode(trans, new_root, inode);
BUG_ON(err);
iput(inode); iput(inode);
return 0; return err;
} }
struct inode *btrfs_alloc_inode(struct super_block *sb) struct inode *btrfs_alloc_inode(struct super_block *sb)
......
...@@ -430,6 +430,11 @@ static noinline int create_subvol(struct btrfs_root *root, ...@@ -430,6 +430,11 @@ static noinline int create_subvol(struct btrfs_root *root,
btrfs_record_root_in_trans(trans, new_root); btrfs_record_root_in_trans(trans, new_root);
ret = btrfs_create_subvol_root(trans, new_root, new_dirid); 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 * insert the directory item
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册