From 8a4d2960b8f0860b5ebf31e60bd74d5d4749af1d Mon Sep 17 00:00:00 2001 From: Jeff Mahoney Date: Mon, 3 Oct 2011 23:23:14 -0400 Subject: [PATCH] btrfs: ->submit_bio_hook error push-up This pushes failures from the submit_bio_hook callbacks, btrfs_submit_bio_hook and btree_submit_bio_hook into the callers, including callers of submit_one_bio where it catches the failures with BUG_ON. It also pushes up through the ->readpage_io_failed_hook to end_bio_extent_writepage where the error is already caught with BUG_ON. Signed-off-by: Jeff Mahoney (cherry picked from commit 355808c296c6923db6705f43639969a80b16d15d) Conflicts: fs/btrfs/extent_io.c fs/btrfs/inode.c Signed-off-by: Liu Bo --- fs/btrfs/disk-io.c | 6 +++--- fs/btrfs/extent_io.c | 18 ++++++++++++++---- fs/btrfs/inode.c | 3 ++- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 977bd5c906d32..27d0f95fb3397 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -867,9 +867,9 @@ static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, { int ret; - ret = btrfs_bio_wq_end_io(BTRFS_I(inode)->root->fs_info, - bio, 1); - BUG_ON(ret); + ret = btrfs_bio_wq_end_io(BTRFS_I(inode)->root->fs_info, bio, 1); + if (ret) + return ret; if (!(rw & REQ_WRITE)) { /* diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 08e4ebf85a97e..ad585719e4bd3 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2323,6 +2323,7 @@ error_handled: if (ret == 0) goto error_handled; } + BUG_ON(ret < 0); } if (uptodate) { @@ -2461,8 +2462,10 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree, if (bio_ret) *bio_ret = bio; - else + else { ret = submit_one_bio(rw, bio, mirror_num, bio_flags); + BUG_ON(ret < 0); + } return ret; } @@ -2676,8 +2679,10 @@ int extent_read_full_page(struct extent_io_tree *tree, struct page *page, ret = __extent_read_full_page(tree, page, get_extent, &bio, mirror_num, &bio_flags); - if (bio) + if (bio) { ret = submit_one_bio(READ, bio, mirror_num, bio_flags); + BUG_ON(ret < 0); + } return ret; } @@ -3095,6 +3100,9 @@ retry: static void flush_epd_write_bio(struct extent_page_data *epd) { if (epd->bio) { + int rw = WRITE; + int ret; + if (epd->sync_io) ret = submit_one_bio(WRITE_SYNC, epd->bio, 0, 0); else @@ -3216,8 +3224,10 @@ int extent_readpages(struct extent_io_tree *tree, page_cache_release(page); } BUG_ON(!list_empty(pages)); - if (bio) - return submit_one_bio(READ, bio, 0, bio_flags); + if (bio) { + int ret = submit_one_bio(READ, bio, 0, bio_flags); + BUG_ON(ret < 0); + } return 0; } diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index b71662783d068..a7f26d728c561 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1571,7 +1571,8 @@ static int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, ret = btrfs_bio_wq_end_io(root->fs_info, bio, 2); else ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); - BUG_ON(ret); + if (ret) + return ret; if (!(rw & REQ_WRITE)) { if (bio_flags & EXTENT_BIO_COMPRESSED) { -- 2.50.1