diff options
author | Junichi Nomura <j-nomura@ce.jp.nec.com> | 2015-10-06 00:19:54 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2015-10-06 10:08:16 -0400 |
commit | 50887bd139b83ce4489ed865a04bf1be5559c4ad (patch) | |
tree | f0d20f339872dfcb613b4418f752e3eae5578e12 | |
parent | 042745ee53a0a7c1f5aff191a4a24213c6dcfb52 (diff) |
dm: fix request-based dm error reporting
end_clone_bio() is a endio callback for clone bio and should check
and save the clone's bi_error for error reporting. However,
4246a0b63bd8 ("block: add a bi_error field to struct bio") changed
the function to check the original bio's bi_error, which is 0.
Without this fix, clone's error is ignored and reported to the
original request as success. Thus data corruption will be observed.
Fixes: 4246a0b63bd8 ("block: add a bi_error field to struct bio")
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r-- | drivers/md/dm.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 7289ece3b560..1b5c6047e4f1 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -1001,6 +1001,7 @@ static void end_clone_bio(struct bio *clone) | |||
1001 | struct dm_rq_target_io *tio = info->tio; | 1001 | struct dm_rq_target_io *tio = info->tio; |
1002 | struct bio *bio = info->orig; | 1002 | struct bio *bio = info->orig; |
1003 | unsigned int nr_bytes = info->orig->bi_iter.bi_size; | 1003 | unsigned int nr_bytes = info->orig->bi_iter.bi_size; |
1004 | int error = clone->bi_error; | ||
1004 | 1005 | ||
1005 | bio_put(clone); | 1006 | bio_put(clone); |
1006 | 1007 | ||
@@ -1011,13 +1012,13 @@ static void end_clone_bio(struct bio *clone) | |||
1011 | * the remainder. | 1012 | * the remainder. |
1012 | */ | 1013 | */ |
1013 | return; | 1014 | return; |
1014 | else if (bio->bi_error) { | 1015 | else if (error) { |
1015 | /* | 1016 | /* |
1016 | * Don't notice the error to the upper layer yet. | 1017 | * Don't notice the error to the upper layer yet. |
1017 | * The error handling decision is made by the target driver, | 1018 | * The error handling decision is made by the target driver, |
1018 | * when the request is completed. | 1019 | * when the request is completed. |
1019 | */ | 1020 | */ |
1020 | tio->error = bio->bi_error; | 1021 | tio->error = error; |
1021 | return; | 1022 | return; |
1022 | } | 1023 | } |
1023 | 1024 | ||