]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
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)
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

index 0a8c8f8304b14c3d9190926eeee3dfa5e3d59d33..91ea57a1474ac38644a5d5bb2612b6b10048c3ce 100644 (file)
@@ -3258,7 +3258,7 @@ static void btrfs_end_bio(struct bio *bio, int err)
                 */
                if (atomic_read(&bbio->error) > bbio->max_errors) {
                        err = -EIO;
-               } else if (err) {
+               } else {
                        /*
                         * this bio is actually up to date, we didn't
                         * go over the max number of errors