Btrfs: fix wrong return value of btrfs_wait_for_commit()
[firefly-linux-kernel-4.4.55.git] / fs / btrfs / compression.c
index c6467aa88bee24fb3f4fe401306aed57442a0a59..94ab2f80e7e3154c517bfae0f873db552f0d052b 100644 (file)
@@ -687,7 +687,8 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
 
                        ret = btrfs_map_bio(root, READ, comp_bio,
                                            mirror_num, 0);
-                       BUG_ON(ret); /* -ENOMEM */
+                       if (ret)
+                               bio_endio(comp_bio, ret);
 
                        bio_put(comp_bio);
 
@@ -712,7 +713,8 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
        }
 
        ret = btrfs_map_bio(root, READ, comp_bio, mirror_num, 0);
-       BUG_ON(ret); /* -ENOMEM */
+       if (ret)
+               bio_endio(comp_bio, ret);
 
        bio_put(comp_bio);
        return 0;