Skip to content

Commit

Permalink
block: don't unecessarily clobber bi_error for chained bios
Browse files Browse the repository at this point in the history
Only overwrite the parents bi_error if it was zero. That way a successful
bio completion doesn't reset the error pointer.

Reported-by: Brian Foster <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Mar 14, 2016
1 parent 3684aa7 commit af3e3a5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions block/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ static void bio_chain_endio(struct bio *bio)
{
struct bio *parent = bio->bi_private;

parent->bi_error = bio->bi_error;
if (!parent->bi_error)
parent->bi_error = bio->bi_error;
bio_endio(parent);
bio_put(bio);
}
Expand Down Expand Up @@ -1753,7 +1754,9 @@ void bio_endio(struct bio *bio)
*/
if (bio->bi_end_io == bio_chain_endio) {
struct bio *parent = bio->bi_private;
parent->bi_error = bio->bi_error;

if (!parent->bi_error)
parent->bi_error = bio->bi_error;
bio_put(bio);
bio = parent;
} else {
Expand Down

0 comments on commit af3e3a5

Please sign in to comment.