summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2011-07-26 20:32:23 +0200
committerDavid Sterba <dsterba@suse.cz>2012-03-22 01:45:36 +0100
commitce598979be6f83549c90f42ba522a19a33727611 (patch)
treeee3cb422fb05012b7c5ff52be720a6d68f97de03 /fs/btrfs/ioctl.c
parentbtrfs: btrfs_drop_snapshot should return int (diff)
downloadlinux-ce598979be6f83549c90f42ba522a19a33727611.tar.xz
linux-ce598979be6f83549c90f42ba522a19a33727611.zip
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>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c5
1 files changed, 5 insertions, 0 deletions
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,
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
*/