dm-flakey: error all IOs when num_features is absent
[ Upstream commit 40ed054f39bc99eac09871c33198e501f4acdf24 ]
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: aa7d7bc99f
("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
4e9e45746b
commit
1aef0e1083
@@ -53,8 +53,8 @@ struct per_bio_data {
|
|||||||
static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
|
static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
|
||||||
struct dm_target *ti)
|
struct dm_target *ti)
|
||||||
{
|
{
|
||||||
int r;
|
int r = 0;
|
||||||
unsigned int argc;
|
unsigned int argc = 0;
|
||||||
const char *arg_name;
|
const char *arg_name;
|
||||||
|
|
||||||
static const struct dm_arg _args[] = {
|
static const struct dm_arg _args[] = {
|
||||||
@@ -65,14 +65,13 @@ static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
|
|||||||
{0, PROBABILITY_BASE, "Invalid random corrupt argument"},
|
{0, PROBABILITY_BASE, "Invalid random corrupt argument"},
|
||||||
};
|
};
|
||||||
|
|
||||||
/* No feature arguments supplied. */
|
if (as->argc && (r = dm_read_arg_group(_args, as, &argc, &ti->error)))
|
||||||
if (!as->argc)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
r = dm_read_arg_group(_args, as, &argc, &ti->error);
|
|
||||||
if (r)
|
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
/* No feature arguments supplied. */
|
||||||
|
if (!argc)
|
||||||
|
goto error_all_io;
|
||||||
|
|
||||||
while (argc) {
|
while (argc) {
|
||||||
arg_name = dm_shift_arg(as);
|
arg_name = dm_shift_arg(as);
|
||||||
argc--;
|
argc--;
|
||||||
@@ -217,6 +216,7 @@ static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
|
|||||||
if (!fc->corrupt_bio_byte && !test_bit(ERROR_READS, &fc->flags) &&
|
if (!fc->corrupt_bio_byte && !test_bit(ERROR_READS, &fc->flags) &&
|
||||||
!test_bit(DROP_WRITES, &fc->flags) && !test_bit(ERROR_WRITES, &fc->flags) &&
|
!test_bit(DROP_WRITES, &fc->flags) && !test_bit(ERROR_WRITES, &fc->flags) &&
|
||||||
!fc->random_read_corrupt && !fc->random_write_corrupt) {
|
!fc->random_read_corrupt && !fc->random_write_corrupt) {
|
||||||
|
error_all_io:
|
||||||
set_bit(ERROR_WRITES, &fc->flags);
|
set_bit(ERROR_WRITES, &fc->flags);
|
||||||
set_bit(ERROR_READS, &fc->flags);
|
set_bit(ERROR_READS, &fc->flags);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user