]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dm-flakey: Fix corrupt_bio_byte setup checks
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 11 Jun 2025 19:12:20 +0000 (15:12 -0400)
committerMikulas Patocka <mpatocka@redhat.com>
Mon, 23 Jun 2025 10:04:52 +0000 (12:04 +0200)
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 <bmarzins@redhat.com>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: Mike Snitzer <snitzer@kernel.org>
Cc: dm-devel@lists.linux.dev
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Fixes: 19da6b2c9e8e ("dm-flakey: Clean up parsing messages")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-flakey.c

index c711db6f8f5ca39e68b4ab43919be04607df9127..cf17fd46e25567ef2387ce72a750fed1ea1900f1 100644 (file)
@@ -215,16 +215,19 @@ static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
        }
 
        if (test_bit(DROP_WRITES, &fc->flags) &&
-           (fc->corrupt_bio_rw == WRITE || fc->random_write_corrupt)) {
+           ((fc->corrupt_bio_byte && fc->corrupt_bio_rw == WRITE) ||
+            fc->random_write_corrupt)) {
                ti->error = "drop_writes is incompatible with random_write_corrupt or corrupt_bio_byte with the WRITE flag set";
                return -EINVAL;
 
        } else if (test_bit(ERROR_WRITES, &fc->flags) &&
-                  (fc->corrupt_bio_rw == WRITE || fc->random_write_corrupt)) {
+                  ((fc->corrupt_bio_byte && fc->corrupt_bio_rw == WRITE) ||
+                   fc->random_write_corrupt)) {
                ti->error = "error_writes is incompatible with random_write_corrupt or corrupt_bio_byte with the WRITE flag set";
                return -EINVAL;
        } else if (test_bit(ERROR_READS, &fc->flags) &&
-                  (fc->corrupt_bio_rw == READ || fc->random_read_corrupt)) {
+                  ((fc->corrupt_bio_byte && fc->corrupt_bio_rw == READ) ||
+                   fc->random_read_corrupt)) {
                ti->error = "error_reads is incompatible with random_read_corrupt or corrupt_bio_byte with the READ flag set";
                return -EINVAL;
        }