lkml.org 
[lkml]   [2004]   [Mar]   [23]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateMon, 22 Mar 2004 23:19:29 -0800
FromMike Christie <>
Subject[PATCH] catch error when completing bio pairs
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
--- 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;
 }
\
 
 \ /
  Last update: 2005-03-22 13:01    [from the cache]
©2003-2008