btrfs: return error value if create_io_em failed in cow_file_range
[sfrench/cifs-2.6.git] / fs / btrfs / inode.c
index 7148abaf1da32a985e7ee3dbb12d1186249c7f98..f81a48c47fe05fa1453f662237a166c3f70f022b 100644 (file)
@@ -1018,8 +1018,10 @@ static noinline int cow_file_range(struct inode *inode,
                                  ram_size, /* ram_bytes */
                                  BTRFS_COMPRESS_NONE, /* compress_type */
                                  BTRFS_ORDERED_REGULAR /* type */);
-               if (IS_ERR(em))
+               if (IS_ERR(em)) {
+                       ret = PTR_ERR(em);
                        goto out_reserve;
+               }
                free_extent_map(em);
 
                ret = btrfs_add_ordered_extent(inode, start, ins.objectid,