dm-flakey.c (8eb29c4fbf9661e6bd4dd86197a37ffe0ecc9d50) dm-flakey.c (aa56b9b75996ff4c76a0a4181c2fa0206c3d91cc)
1/*
2 * Copyright (C) 2003 Sistina Software (UK) Limited.
3 * Copyright (C) 2004, 2010-2011 Red Hat, Inc. All rights reserved.
4 *
5 * This file is released under the GPL.
6 */
7
8#include <linux/device-mapper.h>

--- 351 unchanged lines hidden (view full) ---

360 else if (test_bit(ERROR_WRITES, &fc->flags)) {
361 bio_io_error(bio);
362 return DM_MAPIO_SUBMITTED;
363 }
364
365 /*
366 * Corrupt matching writes.
367 */
1/*
2 * Copyright (C) 2003 Sistina Software (UK) Limited.
3 * Copyright (C) 2004, 2010-2011 Red Hat, Inc. All rights reserved.
4 *
5 * This file is released under the GPL.
6 */
7
8#include <linux/device-mapper.h>

--- 351 unchanged lines hidden (view full) ---

360 else if (test_bit(ERROR_WRITES, &fc->flags)) {
361 bio_io_error(bio);
362 return DM_MAPIO_SUBMITTED;
363 }
364
365 /*
366 * Corrupt matching writes.
367 */
368 if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == WRITE)) {
369 if (all_corrupt_bio_flags_match(bio, fc))
370 corrupt_bio_data(bio, fc);
368 if (fc->corrupt_bio_byte) {
369 if (fc->corrupt_bio_rw == WRITE) {
370 if (all_corrupt_bio_flags_match(bio, fc))
371 corrupt_bio_data(bio, fc);
372 }
371 goto map_bio;
372 }
373
374 /*
375 * By default, error all I/O.
376 */
377 return DM_MAPIO_KILL;
378 }

--- 9 unchanged lines hidden (view full) ---

388{
389 struct flakey_c *fc = ti->private;
390 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data));
391
392 if (op_is_zone_mgmt(bio_op(bio)))
393 return DM_ENDIO_DONE;
394
395 if (!*error && pb->bio_submitted && (bio_data_dir(bio) == READ)) {
373 goto map_bio;
374 }
375
376 /*
377 * By default, error all I/O.
378 */
379 return DM_MAPIO_KILL;
380 }

--- 9 unchanged lines hidden (view full) ---

390{
391 struct flakey_c *fc = ti->private;
392 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data));
393
394 if (op_is_zone_mgmt(bio_op(bio)))
395 return DM_ENDIO_DONE;
396
397 if (!*error && pb->bio_submitted && (bio_data_dir(bio) == READ)) {
396 if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) &&
397 all_corrupt_bio_flags_match(bio, fc)) {
398 /*
399 * Corrupt successful matching READs while in down state.
400 */
401 corrupt_bio_data(bio, fc);
402
398 if (fc->corrupt_bio_byte) {
399 if ((fc->corrupt_bio_rw == READ) &&
400 all_corrupt_bio_flags_match(bio, fc)) {
401 /*
402 * Corrupt successful matching READs while in down state.
403 */
404 corrupt_bio_data(bio, fc);
405 }
403 } else if (!test_bit(DROP_WRITES, &fc->flags) &&
404 !test_bit(ERROR_WRITES, &fc->flags)) {
405 /*
406 * Error read during the down_interval if drop_writes
407 * and error_writes were not configured.
408 */
409 *error = BLK_STS_IOERR;
410 }

--- 117 unchanged lines hidden ---
406 } else if (!test_bit(DROP_WRITES, &fc->flags) &&
407 !test_bit(ERROR_WRITES, &fc->flags)) {
408 /*
409 * Error read during the down_interval if drop_writes
410 * and error_writes were not configured.
411 */
412 *error = BLK_STS_IOERR;
413 }

--- 117 unchanged lines hidden ---