Commit ca6530ab authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] catch errors when completing bio pairs

From: Mike Christie <michaelc@cs.wisc.edu>

A couple of drivers can sometimes fail the first segments in a bio then
requeue the rest of the request.  In this situation, if the last part of
the bio completes successfully bio_pair_end_* will miss that the beginging
of the bio had failed becuase they just return one when bi_size is not yet
zero.  The attached patch moves the error value test before the bi_size to
catch the above case.
parent 2cba47a2
......@@ -701,11 +701,12 @@ static int bio_pair_end_1(struct bio * bi, unsigned int done, int err)
{
struct bio_pair *bp = container_of(bi, struct bio_pair, bio1);
if (bi->bi_size)
return 1;
if (err)
bp->error = err;
if (bi->bi_size)
return 1;
bio_pair_release(bp);
return 0;
}
......@@ -714,11 +715,12 @@ static int bio_pair_end_2(struct bio * bi, unsigned int done, int err)
{
struct bio_pair *bp = container_of(bi, struct bio_pair, bio2);
if (bi->bi_size)
return 1;
if (err)
bp->error = err;
if (bi->bi_size)
return 1;
bio_pair_release(bp);
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment