summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2013-05-14 02:12:15 +0000
committerJosef Bacik <jbacik@fusionio.com>2013-05-17 21:40:27 -0400
commitb9aa55bed1c1a3a329da31884b643c62d57ebb21 (patch)
tree8a471df81a5c15b4750b64360f26681dfa3d7ec3
parentd88033dbf4c23279b012725876f1e164e09644ff (diff)
downloadlinux-b9aa55bed1c1a3a329da31884b643c62d57ebb21.tar.gz
linux-b9aa55bed1c1a3a329da31884b643c62d57ebb21.tar.bz2
linux-b9aa55bed1c1a3a329da31884b643c62d57ebb21.zip
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: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
-rw-r--r--fs/btrfs/inode.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1669c3b4be2f..99a9c25d36a6 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -714,8 +714,10 @@ retry:
async_extent->ram_size - 1, 0);
em = alloc_extent_map();
- if (!em)
+ if (!em) {
+ ret = -ENOMEM;
goto out_free_reserve;
+ }
em->start = async_extent->start;
em->len = async_extent->ram_size;
em->orig_start = em->start;
@@ -922,8 +924,10 @@ static noinline int __cow_file_range(struct btrfs_trans_handle *trans,
}
em = alloc_extent_map();
- if (!em)
+ if (!em) {
+ ret = -ENOMEM;
goto out_reserve;
+ }
em->start = start;
em->orig_start = em->start;
ram_size = ins.offset;