All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm-flakey: Fix corrupt_bio_byte setup checks
@ 2025-06-11 19:12 Kent Overstreet
  2025-06-11 19:13 ` Kent Overstreet
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kent Overstreet @ 2025-06-11 19:12 UTC (permalink / raw)
  Cc: Kent Overstreet, Benjamin Marzinski, Mikulas Patocka,
	Mike Snitzer, dm-devel

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>
---
 drivers/md/dm-flakey.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c
index c711db6f8f5c..cf17fd46e255 100644
--- a/drivers/md/dm-flakey.c
+++ b/drivers/md/dm-flakey.c
@@ -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;
 	}
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] dm-flakey: Fix corrupt_bio_byte setup checks
  2025-06-11 19:12 [PATCH] dm-flakey: Fix corrupt_bio_byte setup checks Kent Overstreet
@ 2025-06-11 19:13 ` Kent Overstreet
  2025-06-11 21:08 ` Benjamin Marzinski
  2025-06-17 16:23 ` Benjamin Marzinski
  2 siblings, 0 replies; 5+ messages in thread
From: Kent Overstreet @ 2025-06-11 19:13 UTC (permalink / raw)
  To: Benjamin Marzinski, Mikulas Patocka, Mike Snitzer, dm-devel

On Wed, Jun 11, 2025 at 03:12:20PM -0400, Kent Overstreet wrote:
> 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>

Also, I see that you guys still aren't testing your changes properly.

> ---
>  drivers/md/dm-flakey.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c
> index c711db6f8f5c..cf17fd46e255 100644
> --- a/drivers/md/dm-flakey.c
> +++ b/drivers/md/dm-flakey.c
> @@ -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;
>  	}
> -- 
> 2.49.0
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dm-flakey: Fix corrupt_bio_byte setup checks
  2025-06-11 19:12 [PATCH] dm-flakey: Fix corrupt_bio_byte setup checks Kent Overstreet
  2025-06-11 19:13 ` Kent Overstreet
@ 2025-06-11 21:08 ` Benjamin Marzinski
  2025-06-17 16:23 ` Benjamin Marzinski
  2 siblings, 0 replies; 5+ messages in thread
From: Benjamin Marzinski @ 2025-06-11 21:08 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: Mikulas Patocka, Mike Snitzer, dm-devel

On Wed, Jun 11, 2025 at 03:12:20PM -0400, Kent Overstreet wrote:
> 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>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dm-flakey: Fix corrupt_bio_byte setup checks
  2025-06-11 19:12 [PATCH] dm-flakey: Fix corrupt_bio_byte setup checks Kent Overstreet
  2025-06-11 19:13 ` Kent Overstreet
  2025-06-11 21:08 ` Benjamin Marzinski
@ 2025-06-17 16:23 ` Benjamin Marzinski
  2025-06-23 10:07   ` Mikulas Patocka
  2 siblings, 1 reply; 5+ messages in thread
From: Benjamin Marzinski @ 2025-06-17 16:23 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: Mikulas Patocka, Mike Snitzer, dm-devel

On Wed, Jun 11, 2025 at 03:12:20PM -0400, Kent Overstreet wrote:
> 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>

This commit header should include:

Fixes: 19da6b2c9e8e ("dm-flakey: Clean up parsing messages")

So that it gets picked up by the stable kernel.

-Ben

> ---
>  drivers/md/dm-flakey.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c
> index c711db6f8f5c..cf17fd46e255 100644
> --- a/drivers/md/dm-flakey.c
> +++ b/drivers/md/dm-flakey.c
> @@ -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;
>  	}
> -- 
> 2.49.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dm-flakey: Fix corrupt_bio_byte setup checks
  2025-06-17 16:23 ` Benjamin Marzinski
@ 2025-06-23 10:07   ` Mikulas Patocka
  0 siblings, 0 replies; 5+ messages in thread
From: Mikulas Patocka @ 2025-06-23 10:07 UTC (permalink / raw)
  To: Benjamin Marzinski; +Cc: Kent Overstreet, Mike Snitzer, dm-devel



On Tue, 17 Jun 2025, Benjamin Marzinski wrote:

> On Wed, Jun 11, 2025 at 03:12:20PM -0400, Kent Overstreet wrote:
> > 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>
> 
> This commit header should include:
> 
> Fixes: 19da6b2c9e8e ("dm-flakey: Clean up parsing messages")
> 
> So that it gets picked up by the stable kernel.
> 
> -Ben

I've applied the patch, thanks.

Mikulas


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-23 10:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 19:12 [PATCH] dm-flakey: Fix corrupt_bio_byte setup checks Kent Overstreet
2025-06-11 19:13 ` Kent Overstreet
2025-06-11 21:08 ` Benjamin Marzinski
2025-06-17 16:23 ` Benjamin Marzinski
2025-06-23 10:07   ` Mikulas Patocka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.