Skip to content

Commit 75227ed

Browse files
Kent OverstreetMikulas Patocka
authored andcommitted
dm-flakey: Fix corrupt_bio_byte setup checks
Fix the error_reads mode - it's incompatible with corrupt_bio_byte, but that's only enabled if corrupt_bio_byte is nonzero. Cc: Benjamin Marzinski <[email protected]> Cc: Mikulas Patocka <[email protected]> Cc: Mike Snitzer <[email protected]> Cc: [email protected] Signed-off-by: Kent Overstreet <[email protected]> Reviewed-by: Benjamin Marzinski <[email protected]> Fixes: 19da6b2 ("dm-flakey: Clean up parsing messages") Signed-off-by: Mikulas Patocka <[email protected]>
1 parent 8ca719b commit 75227ed

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/md/dm-flakey.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,19 @@ static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
215215
}
216216

217217
if (test_bit(DROP_WRITES, &fc->flags) &&
218-
(fc->corrupt_bio_rw == WRITE || fc->random_write_corrupt)) {
218+
((fc->corrupt_bio_byte && fc->corrupt_bio_rw == WRITE) ||
219+
fc->random_write_corrupt)) {
219220
ti->error = "drop_writes is incompatible with random_write_corrupt or corrupt_bio_byte with the WRITE flag set";
220221
return -EINVAL;
221222

222223
} else if (test_bit(ERROR_WRITES, &fc->flags) &&
223-
(fc->corrupt_bio_rw == WRITE || fc->random_write_corrupt)) {
224+
((fc->corrupt_bio_byte && fc->corrupt_bio_rw == WRITE) ||
225+
fc->random_write_corrupt)) {
224226
ti->error = "error_writes is incompatible with random_write_corrupt or corrupt_bio_byte with the WRITE flag set";
225227
return -EINVAL;
226228
} else if (test_bit(ERROR_READS, &fc->flags) &&
227-
(fc->corrupt_bio_rw == READ || fc->random_read_corrupt)) {
229+
((fc->corrupt_bio_byte && fc->corrupt_bio_rw == READ) ||
230+
fc->random_read_corrupt)) {
228231
ti->error = "error_reads is incompatible with random_read_corrupt or corrupt_bio_byte with the READ flag set";
229232
return -EINVAL;
230233
}

0 commit comments

Comments
 (0)