]> www.infradead.org Git - users/jedix/linux-maple.git/commit
dm-flakey: make corrupting read bios work
authorBenjamin Marzinski <bmarzins@redhat.com>
Tue, 22 Apr 2025 23:47:38 +0000 (19:47 -0400)
committerMikulas Patocka <mpatocka@redhat.com>
Sun, 4 May 2025 09:35:05 +0000 (11:35 +0200)
commit13e79076c89f6e96a6cca8f6df38b40d025907b4
tree763c48dbb090619c6df3fbd62dee31c5947c5451
parent4319f0aaa2354f14037f04456ed635983b379695
dm-flakey: make corrupting read bios work

dm-flakey corrupts the read bios in the endio function.  However, the
corrupt_bio_* functions checked bio_has_data() to see if there was data
to corrupt. Since this was the endio function, there was no data left to
complete, so bio_has_data() was always false. Fix this by saving a copy
of the bio's bi_iter in flakey_map(), and using this to initialize the
iter for corrupting the read bios. This patch also skips cloning the bio
for write bios with no data.

Reported-by: Kent Overstreet <kent.overstreet@linux.dev>
Fixes: a3998799fb4df ("dm flakey: add corrupt_bio_byte feature")
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-flakey.c