Btrfs: fix btrfs_end_bio to deal with write errors to a single mirror
authorChris Mason <chris.mason@oracle.com>
Fri, 9 Dec 2011 16:07:37 +0000 (11:07 -0500)
committerChris Mason <chris.mason@oracle.com>
Fri, 9 Dec 2011 16:07:37 +0000 (11:07 -0500)
commit5dbc8fca8ef5d719014f22345d990e957dcfc692
treeadf84c6e10a33cf5cab21487b2443f80a8129509
parent1cf4ffdb3289624a6462c94f2ce05545b32ef736
Btrfs: fix btrfs_end_bio to deal with write errors to a single mirror

btrfs_end_bio checks the number of errors on a bio against the max
number of errors allowed before sending any EIOs up to the higher
levels.

If we got enough copies of the bio done for a given raid level, it is
supposed to clear the bio error flag and return success.

We have pointers to the original bio sent down by the higher layers and
pointers to any cloned bios we made for raid purposes.  If the original
bio happens to be the one that got an io error, but not the last one to
finish, it might not have the BIO_UPTODATE bit set.

Then, when the last bio does finish, we'll call bio_end_io on the
original bio.  It won't have the uptodate bit set and we'll end up
sending EIO to the higher layers.

We already had a check for this, it just was conditional on getting the
IO error on the very last bio.  Make the check unconditional so we eat
the EIOs properly.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/volumes.c