• Chris Mason's avatar
    Btrfs: fix btrfs_end_bio to deal with write errors to a single mirror · 5dbc8fca
    Chris Mason authored
    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: default avatarChris Mason <chris.mason@oracle.com>
    5dbc8fca
volumes.c 94.6 KB