mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] md: Fix non-zero bio->bi_size in MD's bi_end_io callback.
@ 2009-09-09  8:46 Max Lapan
  2009-09-09 10:40 ` NeilBrown
  0 siblings, 1 reply; 3+ messages in thread
From: Max Lapan @ 2009-09-09  8:46 UTC (permalink / raw)
  To: Neil Brown; +Cc: LKML

Neil,

bi_size value in MD's BIO object passed in bi_end_io callback is not
null for successfully completed
BIOs. This may confuse upper layer which may check for bi_size (at the
moment, the only confused FS is GPFS).

    Signed-off-by: Max Lapan <max.lapan@gmail.com>

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 8726fd7..b95e9a2 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -242,6 +242,8 @@ static void raid_end_bio_io(r1bio_t *r1_bio)
 			(unsigned long long) bio->bi_sector +
 				(bio->bi_size >> 9) - 1);

+		if (test_bit(R1BIO_Uptodate, &r1_bio->state))
+			bio->bi_size = 0;
 		bio_endio(bio,
 			test_bit(R1BIO_Uptodate, &r1_bio->state) ? 0 : -EIO);
 	}
@@ -364,6 +366,7 @@ static void raid1_end_write_request(struct bio
*bio, int error)
 					       (unsigned long long) mbio->bi_sector,
 					       (unsigned long long) mbio->bi_sector +
 					       (mbio->bi_size >> 9) - 1);
+					mbio->bi_size = 0;
 					bio_endio(mbio, 0);
 				}
 			}
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 3d9020c..ebe883b 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -235,6 +235,8 @@ static void raid_end_bio_io(r10bio_t *r10_bio)
 {
 	struct bio *bio = r10_bio->master_bio;

+	if (test_bit(R10BIO_Uptodate, &r10_bio->state))
+		bio->bi_size = 0;
 	bio_endio(bio,
 		test_bit(R10BIO_Uptodate, &r10_bio->state) ? 0 : -EIO);
 	free_r10bio(r10_bio);
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index b8a2c5d..fb9560d 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3446,6 +3446,7 @@ static void raid5_align_endio(struct bio *bi, int error)
 	rdev_dec_pending(rdev, conf->mddev);

 	if (!error && uptodate) {
+		raid_bi->bi_size = 0;
 		bio_endio(raid_bi, 0);
 		if (atomic_dec_and_test(&conf->active_aligned_reads))
 			wake_up(&conf->wait_for_stripe);
@@ -3747,7 +3748,7 @@ static int make_request(struct request_queue *q,
struct bio * bi)

 		if ( rw == WRITE )
 			md_write_end(mddev);
-
+		bi->bi_size = 0;
 		bio_endio(bi, 0);
 	}
 	return 0;
@@ -4121,8 +4122,10 @@ static int  retry_aligned_read(raid5_conf_t
*conf, struct bio *raid_bio)
 	spin_lock_irq(&conf->device_lock);
 	remaining = raid5_dec_bi_phys_segments(raid_bio);
 	spin_unlock_irq(&conf->device_lock);
-	if (remaining == 0)
+	if (remaining == 0) {
+		raid_bio->bi_size = 0;
 		bio_endio(raid_bio, 0);
+	}
 	if (atomic_dec_and_test(&conf->active_aligned_reads))
 		wake_up(&conf->wait_for_stripe);
 	return handled;

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

end of thread, other threads:[~2009-09-09 11:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-09  8:46 [patch] md: Fix non-zero bio->bi_size in MD's bi_end_io callback Max Lapan
2009-09-09 10:40 ` NeilBrown
2009-09-09 11:24   ` Max Lapan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®