]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Btrfs: ClearPageError during writepage and clean_tree_block
authorChris Mason <chris.mason@oracle.com>
Fri, 4 Nov 2011 16:29:37 +0000 (12:29 -0400)
committerChris Mason <chris.mason@oracle.com>
Wed, 16 Nov 2011 02:20:51 +0000 (21:20 -0500)
Failure testing was tripping up over stale PageError bits in
metadata pages.  If we have an io error on a block, and later on
end up reusing it, nobody ever clears PageError on those pages.

During commit, we'll find PageError and think we had trouble writing
the block, which will lead to aborts and other problems.

This changes clean_tree_block and the btrfs writepage code to
clear the PageError bit.  In both cases we're either completely
done with the page or the page has good stuff and the error bit
is no longer valid.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
(cherry picked from commit bf0da8c183a15656eee63c54f334c3794320872a)

fs/btrfs/extent_io.c
fs/btrfs/transaction.c

index 8eaef960e2e9a559a2a9ebdbdc705ee0124ba175..5938bd6d3da428e7536d60ff141d229ac02ab843 100644 (file)
@@ -2709,6 +2709,9 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
        trace___extent_writepage(page, inode, wbc);
 
        WARN_ON(!PageLocked(page));
+
+       ClearPageError(page);
+
        pg_offset = i_size & (PAGE_CACHE_SIZE - 1);
        if (page->index > end_index ||
           (page->index == end_index && !pg_offset)) {
@@ -3778,6 +3781,7 @@ int clear_extent_buffer_dirty(struct extent_io_tree *tree,
                                                PAGECACHE_TAG_DIRTY);
                }
                spin_unlock_irq(&page->mapping->tree_lock);
+               ClearPageError(page);
                unlock_page(page);
        }
        return 0;
index 373c7ec1a02626001b855dc1607ba585f787102d..29f782cc2cc93af4ad09dd9444de96e72dbdd690 100644 (file)
@@ -634,7 +634,12 @@ int btrfs_write_and_wait_marked_extents(struct btrfs_root *root,
 
        ret = btrfs_write_marked_extents(root, dirty_pages, mark);
        ret2 = btrfs_wait_marked_extents(root, dirty_pages, mark);
-       return ret || ret2;
+
+       if (ret)
+               return ret;
+       if (ret2)
+               return ret2;
+       return 0;
 }
 
 int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,