1
0
Fork 0

block: don't unecessarily clobber bi_error for chained bios

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 <bfoster@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
hifive-unleashed-5.1
Christoph Hellwig 2016-03-11 17:34:50 +01:00 committed by Jens Axboe
parent 3684aa7099
commit af3e3a5259
1 changed files with 5 additions and 2 deletions

View File

@ -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);
}
@ -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 {