dm integrity: revert to not using discard filler when recalulating
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 12 May 2021 12:28:43 +0000 (08:28 -0400)
committerMike Snitzer <snitzer@redhat.com>
Thu, 13 May 2021 18:53:48 +0000 (14:53 -0400)
commitdbae70d452a0858d62915166d93650c98fe6639c
tree4c8931e03f4786698e664cae7dd2c1c7eeb16871
parentc699a0db2d62e3bbb7f0bf35c87edbc8d23e3062
dm integrity: revert to not using discard filler when recalulating

Revert the commit 7a5b96b4784454ba258e83dc7469ddbacd3aaac3 ("dm integrity:
use discard support when recalculating").

There's a bug that when we write some data beyond the current recalculate
boundary, the checksum will be rewritten with the discard filler later.
And the data will no longer have integrity protection. There's no easy
fix for this case.

Also, another problematic case is if dm-integrity is used to detect
bitrot (random device errors, bit flips, etc); dm-integrity should
detect that even for unused sectors. With commit 7a5b96b4784 it can
happen that such change is undetected (because discard filler is not a
valid checksum).

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Acked-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-integrity.c