]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
Btrfs: don't bug on enomem in readpage
authorJosef Bacik <jbacik@fusionio.com>
Fri, 5 Oct 2012 20:40:32 +0000 (16:40 -0400)
committerChris Mason <chris.mason@fusionio.com>
Tue, 9 Oct 2012 13:20:31 +0000 (09:20 -0400)
Get rid of the BUG_ON(ret == -ENOMEM) in __extent_read_full_page.  Thanks,

Reported-by: Jérôme Poulin <jeromepoulin@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/extent_io.c

index b82d244a2ef5c3cf059f36c17d1d4e8cb4505aba..8c37cb64be7adf7e9dd20a3d3476b57a1e8ad81c 100644 (file)
@@ -2751,12 +2751,15 @@ static int __extent_read_full_page(struct extent_io_tree *tree,
                                         end_bio_extent_readpage, mirror_num,
                                         *bio_flags,
                                         this_bio_flag);
-                       BUG_ON(ret == -ENOMEM);
-                       nr++;
-                       *bio_flags = this_bio_flag;
+                       if (!ret) {
+                               nr++;
+                               *bio_flags = this_bio_flag;
+                       }
                }
-               if (ret)
+               if (ret) {
                        SetPageError(page);
+                       unlock_extent(tree, cur, cur + iosize - 1);
+               }
                cur = cur + iosize;
                pg_offset += iosize;
        }