Commit b9aa55be authored by Liu Bo's avatar Liu Bo Committed by Josef Bacik

Btrfs: return errno if possible when we fail to allocate memory

We need to set return value explicitly, otherwise we'll lose the error
value.
Signed-off-by: default avatarLiu Bo <bo.li.liu@oracle.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent d88033db
...@@ -714,8 +714,10 @@ static noinline int submit_compressed_extents(struct inode *inode, ...@@ -714,8 +714,10 @@ static noinline int submit_compressed_extents(struct inode *inode,
async_extent->ram_size - 1, 0); async_extent->ram_size - 1, 0);
em = alloc_extent_map(); em = alloc_extent_map();
if (!em) if (!em) {
ret = -ENOMEM;
goto out_free_reserve; goto out_free_reserve;
}
em->start = async_extent->start; em->start = async_extent->start;
em->len = async_extent->ram_size; em->len = async_extent->ram_size;
em->orig_start = em->start; em->orig_start = em->start;
...@@ -922,8 +924,10 @@ static noinline int __cow_file_range(struct btrfs_trans_handle *trans, ...@@ -922,8 +924,10 @@ static noinline int __cow_file_range(struct btrfs_trans_handle *trans,
} }
em = alloc_extent_map(); em = alloc_extent_map();
if (!em) if (!em) {
ret = -ENOMEM;
goto out_reserve; goto out_reserve;
}
em->start = start; em->start = start;
em->orig_start = em->start; em->orig_start = em->start;
ram_size = ins.offset; ram_size = ins.offset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment