Mikulas Patocka aa587257e1 dm-integrity: align the outgoing bio in integrity_recheck
[ Upstream commit b4d78cfeb30476239cf08f4f40afc095c173d6e3 ]

It is possible to set up dm-integrity with smaller sector size than
the logical sector size of the underlying device. In this situation,
dm-integrity guarantees that the outgoing bios have the same alignment as
incoming bios (so, if you create a filesystem with 4k block size,
dm-integrity would send 4k-aligned bios to the underlying device).

This guarantee was broken when integrity_recheck was implemented.
integrity_recheck sends bio that is aligned to ic->sectors_per_block. So
if we set up integrity with 512-byte sector size on a device with logical
block size 4k, we would be sending unaligned bio. This triggered a bug in
one of our internal tests.

This commit fixes it by determining the actual alignment of the
incoming bio and then makes sure that the outgoing bio in
integrity_recheck has the same alignment.

Fixes: c88f5e553fe3 ("dm-integrity: recheck the integrity tag after a failure")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:21:03 -04:00
..
2024-03-26 18:21:02 -04:00
2024-03-26 18:21:02 -04:00
2024-03-26 18:21:02 -04:00
2024-03-26 18:21:02 -04:00
2024-03-26 18:21:02 -04:00
2023-07-19 16:22:07 +02:00
2024-03-26 18:21:02 -04:00
2024-03-26 18:21:02 -04:00
2024-03-26 18:21:02 -04:00
2024-03-26 18:21:02 -04:00
2023-07-19 16:22:07 +02:00
2024-03-26 18:21:02 -04:00
2024-03-26 18:21:02 -04:00
2023-04-13 16:55:17 +02:00
2022-08-02 14:38:59 -07:00
2022-03-08 15:16:54 -08:00