summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-flakey.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-flakey.c')
-rw-r--r--drivers/md/dm-flakey.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c
index 13305a182611..3d04d5ce19d9 100644
--- a/drivers/md/dm-flakey.c
+++ b/drivers/md/dm-flakey.c
@@ -321,7 +321,7 @@ static int flakey_map(struct dm_target *ti, struct bio *bio)
321 if (bio_data_dir(bio) == READ) { 321 if (bio_data_dir(bio) == READ) {
322 if (!fc->corrupt_bio_byte && !test_bit(DROP_WRITES, &fc->flags) && 322 if (!fc->corrupt_bio_byte && !test_bit(DROP_WRITES, &fc->flags) &&
323 !test_bit(ERROR_WRITES, &fc->flags)) 323 !test_bit(ERROR_WRITES, &fc->flags))
324 return -EIO; 324 return DM_MAPIO_KILL;
325 goto map_bio; 325 goto map_bio;
326 } 326 }
327 327
@@ -349,7 +349,7 @@ static int flakey_map(struct dm_target *ti, struct bio *bio)
349 /* 349 /*
350 * By default, error all I/O. 350 * By default, error all I/O.
351 */ 351 */
352 return -EIO; 352 return DM_MAPIO_KILL;
353 } 353 }
354 354
355map_bio: 355map_bio:
@@ -358,12 +358,13 @@ map_bio:
358 return DM_MAPIO_REMAPPED; 358 return DM_MAPIO_REMAPPED;
359} 359}
360 360
361static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error) 361static int flakey_end_io(struct dm_target *ti, struct bio *bio,
362 blk_status_t *error)
362{ 363{
363 struct flakey_c *fc = ti->private; 364 struct flakey_c *fc = ti->private;
364 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); 365 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data));
365 366
366 if (!error && pb->bio_submitted && (bio_data_dir(bio) == READ)) { 367 if (!*error && pb->bio_submitted && (bio_data_dir(bio) == READ)) {
367 if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) && 368 if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) &&
368 all_corrupt_bio_flags_match(bio, fc)) { 369 all_corrupt_bio_flags_match(bio, fc)) {
369 /* 370 /*
@@ -377,11 +378,11 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error)
377 * Error read during the down_interval if drop_writes 378 * Error read during the down_interval if drop_writes
378 * and error_writes were not configured. 379 * and error_writes were not configured.
379 */ 380 */
380 return -EIO; 381 *error = BLK_STS_IOERR;
381 } 382 }
382 } 383 }
383 384
384 return error; 385 return DM_ENDIO_DONE;
385} 386}
386 387
387static void flakey_status(struct dm_target *ti, status_type_t type, 388static void flakey_status(struct dm_target *ti, status_type_t type,