diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2009-06-22 05:12:18 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-06-22 05:12:18 -0400 |
commit | 5aa2781d964e9835c441932110484bc454b5c207 (patch) | |
tree | 4f771f3e933eaedf67e5f9e8d5fcc10340af80e2 /drivers | |
parent | 2761e95fe40ca0d01864310fa4d488d7c5e34e18 (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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 910bce85f443..77972090abe5 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) | |||
555 | * a per-device variable for error reporting. | 555 | * a per-device variable for error reporting. |
556 | * Note that you can't touch the bio after end_io_acct | 556 | * Note that you can't touch the bio after end_io_acct |
557 | */ | 557 | */ |
558 | md->barrier_error = io_error; | 558 | if (!md->barrier_error) |
559 | md->barrier_error = io_error; | ||
559 | end_io_acct(io); | 560 | end_io_acct(io); |
560 | } else { | 561 | } else { |
561 | end_io_acct(io); | 562 | end_io_acct(io); |
@@ -867,7 +868,8 @@ static void __split_and_process_bio(struct mapped_device *md, struct bio *bio) | |||
867 | if (!bio_barrier(bio)) | 868 | if (!bio_barrier(bio)) |
868 | bio_io_error(bio); | 869 | bio_io_error(bio); |
869 | else | 870 | else |
870 | md->barrier_error = -EIO; | 871 | if (!md->barrier_error) |
872 | md->barrier_error = -EIO; | ||
871 | return; | 873 | return; |
872 | } | 874 | } |
873 | 875 | ||
@@ -1448,16 +1450,15 @@ static void dm_flush(struct mapped_device *md) | |||
1448 | 1450 | ||
1449 | static void process_barrier(struct mapped_device *md, struct bio *bio) | 1451 | static void process_barrier(struct mapped_device *md, struct bio *bio) |
1450 | { | 1452 | { |
1453 | md->barrier_error = 0; | ||
1454 | |||
1451 | dm_flush(md); | 1455 | dm_flush(md); |
1452 | 1456 | ||
1453 | if (bio_empty_barrier(bio)) { | 1457 | if (!bio_empty_barrier(bio)) { |
1454 | bio_endio(bio, 0); | 1458 | __split_and_process_bio(md, bio); |
1455 | return; | 1459 | dm_flush(md); |
1456 | } | 1460 | } |
1457 | 1461 | ||
1458 | __split_and_process_bio(md, bio); | ||
1459 | dm_flush(md); | ||
1460 | |||
1461 | if (md->barrier_error != DM_ENDIO_REQUEUE) | 1462 | if (md->barrier_error != DM_ENDIO_REQUEUE) |
1462 | bio_endio(bio, md->barrier_error); | 1463 | bio_endio(bio, md->barrier_error); |
1463 | else { | 1464 | else { |