summaryrefslogtreecommitdiff
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-04-23 23:10:49 (GMT)
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-04-23 23:10:49 (GMT)
commit5e82849e63723afe720d4b325d04a989f6247cce (patch)
tree7668ad278ea1c8ee2c661dceddcf81fde1201ced /fs/btrfs/super.c
parent5d0c3e60fea7e23fbfbe3ab2886b444b4c702441 (diff)
downloadlinux-5e82849e63723afe720d4b325d04a989f6247cce.tar.xz
Btrfs: new subvolume oops fix
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index eba239cc..6940a90 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2013,6 +2013,8 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen)
BUG_ON(!trans);
subvol = btrfs_alloc_free_block(trans, root);
+ if (subvol == NULL)
+ return -ENOSPC;
leaf = btrfs_buffer_leaf(subvol);
btrfs_set_header_nritems(&leaf->header, 0);
btrfs_set_header_level(&leaf->header, 0);
@@ -2022,8 +2024,6 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen)
memcpy(leaf->header.fsid, root->fs_info->disk_super->fsid,
sizeof(leaf->header.fsid));
mark_buffer_dirty(subvol);
- brelse(subvol);
- subvol = NULL;
inode_item = &root_item.inode;
memset(inode_item, 0, sizeof(*inode_item));
@@ -2035,6 +2035,8 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen)
btrfs_set_root_blocknr(&root_item, bh_blocknr(subvol));
btrfs_set_root_refs(&root_item, 1);
+ brelse(subvol);
+ subvol = NULL;
ret = btrfs_find_free_objectid(trans, root->fs_info->tree_root,
0, &objectid);