Btrfs: fix return value check of extent_io_ops
authorTsutomu Itoh <t-itoh@jp.fujitsu.com>
Thu, 16 Feb 2012 01:11:40 +0000 (10:11 +0900)
committerDavid Sterba <dsterba@suse.cz>
Thu, 16 Feb 2012 16:23:16 +0000 (17:23 +0100)
This patch adds the check on the return value of extent_io_ops.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
fs/btrfs/extent_io.c

index 89ba79fb945c3aeecb8a5e6dff0c85ee4497d6c9..b05d35a7c0f1fa388b2511a968d6594740604122 100644 (file)
@@ -2154,9 +2154,10 @@ static int bio_readpage_error(struct bio *failed_bio, struct page *page,
                 "this_mirror=%d, num_copies=%d, in_validation=%d\n", read_mode,
                 failrec->this_mirror, num_copies, failrec->in_validation);
 
-       tree->ops->submit_bio_hook(inode, read_mode, bio, failrec->this_mirror,
-                                       failrec->bio_flags, 0);
-       return 0;
+       ret = tree->ops->submit_bio_hook(inode, read_mode, bio,
+                                        failrec->this_mirror,
+                                        failrec->bio_flags, 0);
+       return ret;
 }
 
 /* lots and lots of room for performance fixes in the end_bio funcs */
@@ -2790,9 +2791,12 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
                                delalloc_start = delalloc_end + 1;
                                continue;
                        }
-                       tree->ops->fill_delalloc(inode, page, delalloc_start,
-                                                delalloc_end, &page_started,
-                                                &nr_written);
+                       ret = tree->ops->fill_delalloc(inode, page,
+                                                      delalloc_start,
+                                                      delalloc_end,
+                                                      &page_started,
+                                                      &nr_written);
+                       BUG_ON(ret);
                        /*
                         * delalloc_end is already one less than the total
                         * length, so we don't subtract one from