From: Max Lapan <max.lapan@gmail.com>
To: Neil Brown <neilb@suse.de>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [patch] md: Fix non-zero bio->bi_size in MD's bi_end_io callback.
Date: Wed, 9 Sep 2009 12:46:35 +0400 [thread overview]
Message-ID: <d960726f0909090146n7c96e143le137cd74c23dc065@mail.gmail.com> (raw)
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;
next reply other threads:[~2009-09-09 8:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-09 8:46 Max Lapan [this message]
2009-09-09 10:40 ` NeilBrown
2009-09-09 11:24 ` Max Lapan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d960726f0909090146n7c96e143le137cd74c23dc065@mail.gmail.com \
--to=max.lapan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®