diff options
| -rw-r--r-- | drivers/md/dm-bio-prison.c | 4 | ||||
| -rw-r--r-- | drivers/md/dm-bio-prison.h | 2 | ||||
| -rw-r--r-- | drivers/md/dm-thin.c | 38 |
3 files changed, 27 insertions, 17 deletions
diff --git a/drivers/md/dm-bio-prison.c b/drivers/md/dm-bio-prison.c index 85f0b7074257..71434382cb64 100644 --- a/drivers/md/dm-bio-prison.c +++ b/drivers/md/dm-bio-prison.c | |||
| @@ -238,7 +238,7 @@ void dm_cell_release_no_holder(struct dm_bio_prison *prison, | |||
| 238 | EXPORT_SYMBOL_GPL(dm_cell_release_no_holder); | 238 | EXPORT_SYMBOL_GPL(dm_cell_release_no_holder); |
| 239 | 239 | ||
| 240 | void dm_cell_error(struct dm_bio_prison *prison, | 240 | void dm_cell_error(struct dm_bio_prison *prison, |
| 241 | struct dm_bio_prison_cell *cell) | 241 | struct dm_bio_prison_cell *cell, int error) |
| 242 | { | 242 | { |
| 243 | struct bio_list bios; | 243 | struct bio_list bios; |
| 244 | struct bio *bio; | 244 | struct bio *bio; |
| @@ -251,7 +251,7 @@ void dm_cell_error(struct dm_bio_prison *prison, | |||
| 251 | spin_unlock_irqrestore(&prison->lock, flags); | 251 | spin_unlock_irqrestore(&prison->lock, flags); |
| 252 | 252 | ||
| 253 | while ((bio = bio_list_pop(&bios))) | 253 | while ((bio = bio_list_pop(&bios))) |
| 254 | bio_io_error(bio); | 254 | bio_endio(bio, error); |
| 255 | } | 255 | } |
| 256 | EXPORT_SYMBOL_GPL(dm_cell_error); | 256 | EXPORT_SYMBOL_GPL(dm_cell_error); |
| 257 | 257 | ||
diff --git a/drivers/md/dm-bio-prison.h b/drivers/md/dm-bio-prison.h index 3f833190eadf..6805a142b750 100644 --- a/drivers/md/dm-bio-prison.h +++ b/drivers/md/dm-bio-prison.h | |||
| @@ -85,7 +85,7 @@ void dm_cell_release_no_holder(struct dm_bio_prison *prison, | |||
| 85 | struct dm_bio_prison_cell *cell, | 85 | struct dm_bio_prison_cell *cell, |
| 86 | struct bio_list *inmates); | 86 | struct bio_list *inmates); |
| 87 | void dm_cell_error(struct dm_bio_prison *prison, | 87 | void dm_cell_error(struct dm_bio_prison *prison, |
| 88 | struct dm_bio_prison_cell *cell); | 88 | struct dm_bio_prison_cell *cell, int error); |
| 89 | 89 | ||
| 90 | /*----------------------------------------------------------------*/ | 90 | /*----------------------------------------------------------------*/ |
| 91 | 91 | ||
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 7694988fb806..a0bdd562e026 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
| @@ -310,13 +310,18 @@ static void cell_defer_no_holder_no_free(struct thin_c *tc, | |||
| 310 | wake_worker(pool); | 310 | wake_worker(pool); |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | static void cell_error(struct pool *pool, | 313 | static void cell_error_with_code(struct pool *pool, |
| 314 | struct dm_bio_prison_cell *cell) | 314 | struct dm_bio_prison_cell *cell, int error_code) |
| 315 | { | 315 | { |
| 316 | dm_cell_error(pool->prison, cell); | 316 | dm_cell_error(pool->prison, cell, error_code); |
| 317 | dm_bio_prison_free_cell(pool->prison, cell); | 317 | dm_bio_prison_free_cell(pool->prison, cell); |
| 318 | } | 318 | } |
| 319 | 319 | ||
| 320 | static void cell_error(struct pool *pool, struct dm_bio_prison_cell *cell) | ||
| 321 | { | ||
| 322 | cell_error_with_code(pool, cell, -EIO); | ||
| 323 | } | ||
| 324 | |||
| 320 | /*----------------------------------------------------------------*/ | 325 | /*----------------------------------------------------------------*/ |
| 321 | 326 | ||
| 322 | /* | 327 | /* |
| @@ -1027,7 +1032,7 @@ static void retry_on_resume(struct bio *bio) | |||
| 1027 | spin_unlock_irqrestore(&tc->lock, flags); | 1032 | spin_unlock_irqrestore(&tc->lock, flags); |
| 1028 | } | 1033 | } |
| 1029 | 1034 | ||
| 1030 | static bool should_error_unserviceable_bio(struct pool *pool) | 1035 | static int should_error_unserviceable_bio(struct pool *pool) |
| 1031 | { | 1036 | { |
| 1032 | enum pool_mode m = get_pool_mode(pool); | 1037 | enum pool_mode m = get_pool_mode(pool); |
| 1033 | 1038 | ||
| @@ -1035,25 +1040,27 @@ static bool should_error_unserviceable_bio(struct pool *pool) | |||
| 1035 | case PM_WRITE: | 1040 | case PM_WRITE: |
| 1036 | /* Shouldn't get here */ | 1041 | /* Shouldn't get here */ |
| 1037 | DMERR_LIMIT("bio unserviceable, yet pool is in PM_WRITE mode"); | 1042 | DMERR_LIMIT("bio unserviceable, yet pool is in PM_WRITE mode"); |
| 1038 | return true; | 1043 | return -EIO; |
| 1039 | 1044 | ||
| 1040 | case PM_OUT_OF_DATA_SPACE: | 1045 | case PM_OUT_OF_DATA_SPACE: |
| 1041 | return pool->pf.error_if_no_space; | 1046 | return pool->pf.error_if_no_space ? -ENOSPC : 0; |
| 1042 | 1047 | ||
| 1043 | case PM_READ_ONLY: | 1048 | case PM_READ_ONLY: |
| 1044 | case PM_FAIL: | 1049 | case PM_FAIL: |
| 1045 | return true; | 1050 | return -EIO; |
| 1046 | default: | 1051 | default: |
| 1047 | /* Shouldn't get here */ | 1052 | /* Shouldn't get here */ |
| 1048 | DMERR_LIMIT("bio unserviceable, yet pool has an unknown mode"); | 1053 | DMERR_LIMIT("bio unserviceable, yet pool has an unknown mode"); |
| 1049 | return true; | 1054 | return -EIO; |
| 1050 | } | 1055 | } |
| 1051 | } | 1056 | } |
| 1052 | 1057 | ||
| 1053 | static void handle_unserviceable_bio(struct pool *pool, struct bio *bio) | 1058 | static void handle_unserviceable_bio(struct pool *pool, struct bio *bio) |
| 1054 | { | 1059 | { |
| 1055 | if (should_error_unserviceable_bio(pool)) | 1060 | int error = should_error_unserviceable_bio(pool); |
| 1056 | bio_io_error(bio); | 1061 | |
| 1062 | if (error) | ||
| 1063 | bio_endio(bio, error); | ||
| 1057 | else | 1064 | else |
| 1058 | retry_on_resume(bio); | 1065 | retry_on_resume(bio); |
| 1059 | } | 1066 | } |
| @@ -1062,18 +1069,21 @@ static void retry_bios_on_resume(struct pool *pool, struct dm_bio_prison_cell *c | |||
| 1062 | { | 1069 | { |
| 1063 | struct bio *bio; | 1070 | struct bio *bio; |
| 1064 | struct bio_list bios; | 1071 | struct bio_list bios; |
| 1072 | int error; | ||
| 1065 | 1073 | ||
| 1066 | if (should_error_unserviceable_bio(pool)) { | 1074 | error = should_error_unserviceable_bio(pool); |
| 1067 | cell_error(pool, cell); | 1075 | if (error) { |
| 1076 | cell_error_with_code(pool, cell, error); | ||
| 1068 | return; | 1077 | return; |
| 1069 | } | 1078 | } |
| 1070 | 1079 | ||
| 1071 | bio_list_init(&bios); | 1080 | bio_list_init(&bios); |
| 1072 | cell_release(pool, cell, &bios); | 1081 | cell_release(pool, cell, &bios); |
| 1073 | 1082 | ||
| 1074 | if (should_error_unserviceable_bio(pool)) | 1083 | error = should_error_unserviceable_bio(pool); |
| 1084 | if (error) | ||
| 1075 | while ((bio = bio_list_pop(&bios))) | 1085 | while ((bio = bio_list_pop(&bios))) |
| 1076 | bio_io_error(bio); | 1086 | bio_endio(bio, error); |
| 1077 | else | 1087 | else |
| 1078 | while ((bio = bio_list_pop(&bios))) | 1088 | while ((bio = bio_list_pop(&bios))) |
| 1079 | retry_on_resume(bio); | 1089 | retry_on_resume(bio); |
