diff options
author | Mark Fasheh <mfasheh@suse.com> | 2011-07-26 14:32:23 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2012-03-21 20:45:36 -0400 |
commit | ce598979be6f83549c90f42ba522a19a33727611 (patch) | |
tree | ee3cb422fb05012b7c5ff52be720a6d68f97de03 | |
parent | 2c536799f1bde905bbacf7af3aa6be3f4de66005 (diff) |
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: Mark Fasheh <mfasheh@suse.com>
-rw-r--r-- | fs/btrfs/inode.c | 3 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 593a2c3a27ab..41132339e2ea 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -6734,10 +6734,9 @@ int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, | |||
6734 | btrfs_i_size_write(inode, 0); | 6734 | btrfs_i_size_write(inode, 0); |
6735 | 6735 | ||
6736 | err = btrfs_update_inode(trans, new_root, inode); | 6736 | err = btrfs_update_inode(trans, new_root, inode); |
6737 | BUG_ON(err); | ||
6738 | 6737 | ||
6739 | iput(inode); | 6738 | iput(inode); |
6740 | return 0; | 6739 | return err; |
6741 | } | 6740 | } |
6742 | 6741 | ||
6743 | struct inode *btrfs_alloc_inode(struct super_block *sb) | 6742 | struct inode *btrfs_alloc_inode(struct super_block *sb) |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 4e5149461435..de25e4255aeb 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -430,6 +430,11 @@ static noinline int create_subvol(struct btrfs_root *root, | |||
430 | btrfs_record_root_in_trans(trans, new_root); | 430 | btrfs_record_root_in_trans(trans, new_root); |
431 | 431 | ||
432 | ret = btrfs_create_subvol_root(trans, new_root, new_dirid); | 432 | ret = btrfs_create_subvol_root(trans, new_root, new_dirid); |
433 | if (ret) { | ||
434 | /* We potentially lose an unused inode item here */ | ||
435 | goto fail; | ||
436 | } | ||
437 | |||
433 | /* | 438 | /* |
434 | * insert the directory item | 439 | * insert the directory item |
435 | */ | 440 | */ |