diff options
author | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2012-03-23 12:24:19 -0400 |
---|---|---|
committer | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2012-03-27 08:51:20 -0400 |
commit | 103e976616fe9c2a3e40764c979fa1a592274da2 (patch) | |
tree | 77d806d5a59168e14927655dfbbe3d49bd7fbe5b /fs/btrfs | |
parent | e565d4b962948e70f37f417603caf131a773621b (diff) |
Btrfs: check return value of btrfs_cow_block()
The two helper functions commit_cowonly_roots() and
create_pending_snapshot() failed to check the return value from
btrfs_cow_block(), which could at least in theory fail with -ENOSPC from
btrfs_alloc_free_block(). This commit adds the missing checks.
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/transaction.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 04b77e3ceb7a..cd220f283638 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -718,7 +718,8 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans, | |||
718 | BUG_ON(ret); | 718 | BUG_ON(ret); |
719 | 719 | ||
720 | eb = btrfs_lock_root_node(fs_info->tree_root); | 720 | eb = btrfs_lock_root_node(fs_info->tree_root); |
721 | btrfs_cow_block(trans, fs_info->tree_root, eb, NULL, 0, &eb); | 721 | ret = btrfs_cow_block(trans, fs_info->tree_root, eb, NULL, 0, &eb); |
722 | BUG_ON(ret); | ||
722 | btrfs_tree_unlock(eb); | 723 | btrfs_tree_unlock(eb); |
723 | free_extent_buffer(eb); | 724 | free_extent_buffer(eb); |
724 | 725 | ||
@@ -949,7 +950,8 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
949 | btrfs_set_root_flags(new_root_item, root_flags); | 950 | btrfs_set_root_flags(new_root_item, root_flags); |
950 | 951 | ||
951 | old = btrfs_lock_root_node(root); | 952 | old = btrfs_lock_root_node(root); |
952 | btrfs_cow_block(trans, root, old, NULL, 0, &old); | 953 | ret = btrfs_cow_block(trans, root, old, NULL, 0, &old); |
954 | BUG_ON(ret); | ||
953 | btrfs_set_lock_blocking(old); | 955 | btrfs_set_lock_blocking(old); |
954 | 956 | ||
955 | btrfs_copy_root(trans, root, old, &tmp, objectid); | 957 | btrfs_copy_root(trans, root, old, &tmp, objectid); |