Skip to content

Commit

Permalink
Btrfs: mark the bio with an error if we have a failure in dio
Browse files Browse the repository at this point in the history
I noticed that dio_end_io calls the appropriate endio function with an error,
but the endio functions don't actually do anything with that error, they assume
that if there was an error then the bio will not be uptodate.  So if we had
checksum failures we would never pass back EIO.  So if there is an error in our
endio functions make sure to clear the uptodate flag on the bio.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
  • Loading branch information
Josef Bacik authored and Chris Mason committed Mar 25, 2011
1 parent 98bc314 commit c0da7aa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -5744,6 +5744,10 @@ static void btrfs_endio_direct_read(struct bio *bio, int err)

kfree(dip->csums);
kfree(dip);

/* If we had a csum failure make sure to clear the uptodate flag */
if (err)
clear_bit(BIO_UPTODATE, &bio->bi_flags);
dio_end_io(bio, err);
}

Expand Down Expand Up @@ -5845,6 +5849,10 @@ static void btrfs_endio_direct_write(struct bio *bio, int err)

kfree(dip->csums);
kfree(dip);

/* If we had an error make sure to clear the uptodate flag */
if (err)
clear_bit(BIO_UPTODATE, &bio->bi_flags);
dio_end_io(bio, err);
}

Expand Down

0 comments on commit c0da7aa

Please sign in to comment.