linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] catch error when completing bio pairs
@ 2004-03-23  7:19 Mike Christie
  2004-03-24  8:29 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Christie @ 2004-03-23  7:19 UTC (permalink / raw)
  To: Linux Kernel, Jens Axboe

[-- Attachment #1: Type: text/plain, Size: 405 bytes --]

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.

Mike Christie

[-- Attachment #2: biopair-err.patch --]
[-- Type: text/plain, Size: 675 bytes --]

--- linux-2.6.5-rc2/fs/bio.c	2004-03-22 22:44:28.000000000 -0800
+++ linux-2.6.5-rc2-ec/fs/bio.c	2004-03-22 23:00:18.000000000 -0800
@@ -701,11 +701,12 @@ static int bio_pair_end_1(struct bio * b
 {
 	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 * b
 {
 	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;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] catch error when completing bio pairs
  2004-03-23  7:19 [PATCH] catch error when completing bio pairs Mike Christie
@ 2004-03-24  8:29 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2004-03-24  8:29 UTC (permalink / raw)
  To: Mike Christie; +Cc: Linux Kernel

On Mon, Mar 22 2004, Mike Christie wrote:
> 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.

Yup that's a bug, patch is correct.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-24  8:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-23  7:19 [PATCH] catch error when completing bio pairs Mike Christie
2004-03-24  8:29 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).