aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-06-22 10:12:18 +0100
committerAlasdair G Kergon <agk@redhat.com>2009-06-22 10:12:18 +0100
commit5aa2781d964e9835c441932110484bc454b5c207 (patch)
tree4f771f3e933eaedf67e5f9e8d5fcc10340af80e2
parent2761e95fe40ca0d01864310fa4d488d7c5e34e18 (diff)
dm: store only first barrier error
With the following patches, more than one error can occur during processing. Change md->barrier_error so that only the first one is recorded and returned to the caller. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
-rw-r--r--drivers/md/dm.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 910bce85f44..77972090abe 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -555,7 +555,8 @@ static void dec_pending(struct dm_io *io, int error)
* a per-device variable for error reporting.
* Note that you can't touch the bio after end_io_acct
*/
- md->barrier_error = io_error;
+ if (!md->barrier_error)
+ md->barrier_error = io_error;
end_io_acct(io);
} else {
end_io_acct(io);
@@ -867,7 +868,8 @@ static void __split_and_process_bio(struct mapped_device *md, struct bio *bio)
if (!bio_barrier(bio))
bio_io_error(bio);
else
- md->barrier_error = -EIO;
+ if (!md->barrier_error)
+ md->barrier_error = -EIO;
return;
}
@@ -1448,16 +1450,15 @@ static void dm_flush(struct mapped_device *md)
static void process_barrier(struct mapped_device *md, struct bio *bio)
{
+ md->barrier_error = 0;
+
dm_flush(md);
- if (bio_empty_barrier(bio)) {
- bio_endio(bio, 0);
- return;
+ if (!bio_empty_barrier(bio)) {
+ __split_and_process_bio(md, bio);
+ dm_flush(md);
}
- __split_and_process_bio(md, bio);
- dm_flush(md);
-
if (md->barrier_error != DM_ENDIO_REQUEUE)
bio_endio(bio, md->barrier_error);
else {