aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-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 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
1449static void process_barrier(struct mapped_device *md, struct bio *bio) 1451static 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 {