Commit 84126960 authored by Benjamin Marzinski's avatar Benjamin Marzinski Committed by Greg Kroah-Hartman
Browse files

dm-flakey: make corrupting read bios work



[ Upstream commit 13e79076 ]

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: default avatarKent Overstreet <kent.overstreet@linux.dev>
Fixes: a3998799 ("dm flakey: add corrupt_bio_byte feature")
Signed-off-by: default avatarBenjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 1aef0e10
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment