Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dm-flakey: error all IOs when num_features is absent

dm-flakey would error all IOs if num_features was 0, but if it was
absent, dm-flakey would never error any IO. Fix this so that no
num_features works the same as num_features set to 0.

Fixes: aa7d7bc99fed7 ("dm flakey: add an "error_reads" option")
Reported-by: Kent Overstreet <kent.overstreet@linux.dev>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

authored by

Benjamin Marzinski and committed by
Mikulas Patocka
40ed054f 19da6b2c

+8 -8
+8 -8
drivers/md/dm-flakey.c
··· 53 53 static int parse_features(struct dm_arg_set *as, struct flakey_c *fc, 54 54 struct dm_target *ti) 55 55 { 56 - int r; 57 - unsigned int argc; 56 + int r = 0; 57 + unsigned int argc = 0; 58 58 const char *arg_name; 59 59 60 60 static const struct dm_arg _args[] = { ··· 65 65 {0, PROBABILITY_BASE, "Invalid random corrupt argument"}, 66 66 }; 67 67 68 - /* No feature arguments supplied. */ 69 - if (!as->argc) 70 - return 0; 71 - 72 - r = dm_read_arg_group(_args, as, &argc, &ti->error); 73 - if (r) 68 + if (as->argc && (r = dm_read_arg_group(_args, as, &argc, &ti->error))) 74 69 return r; 70 + 71 + /* No feature arguments supplied. */ 72 + if (!argc) 73 + goto error_all_io; 75 74 76 75 while (argc) { 77 76 arg_name = dm_shift_arg(as); ··· 231 232 if (!fc->corrupt_bio_byte && !test_bit(ERROR_READS, &fc->flags) && 232 233 !test_bit(DROP_WRITES, &fc->flags) && !test_bit(ERROR_WRITES, &fc->flags) && 233 234 !fc->random_read_corrupt && !fc->random_write_corrupt) { 235 + error_all_io: 234 236 set_bit(ERROR_WRITES, &fc->flags); 235 237 set_bit(ERROR_READS, &fc->flags); 236 238 }