]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
dm-integrity: fix recalculation in bitmap mode
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 19 Jan 2026 14:06:02 +0000 (15:06 +0100)
committerMikulas Patocka <mpatocka@redhat.com>
Mon, 19 Jan 2026 15:16:53 +0000 (16:16 +0100)
commit118ba36e446c01e3cd34b3eedabf1d9436525e1d
tree743b5810babce1d0ed8e5a9ce57730986f916d6a
parentbe9badced98f89cf5c6f7690f7d9739a213c4502
dm-integrity: fix recalculation in bitmap mode

There's a logic quirk in the handling of suspend in the bitmap mode:

This is the sequence of calls if we are reloading a dm-integrity table:
* dm_integrity_ctr reads a superblock with the flag SB_FLAG_DIRTY_BITMAP
  set.
* dm_integrity_postsuspend initializes a journal and clears the flag
  SB_FLAG_DIRTY_BITMAP.
* dm_integrity_resume sees the superblock with SB_FLAG_DIRTY_BITMAP set -
  thus it interprets the journal as if it were a bitmap.

This quirk causes recalculation problem if the user increases the size of
the device in the bitmap mode.

Fix this by reading a fresh copy on the superblock in
dm_integrity_resume. This commit also fixes another logic quirk - the
branch that sets bitmap bits if the device was extended should only be
executed if the flag SB_FLAG_DIRTY_BITMAP is set.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Tested-by: Ondrej Kozina <okozina@redhat.com>
Fixes: 468dfca38b1a ("dm integrity: add a bitmap mode")
Cc: stable@vger.kernel.org
drivers/md/dm-integrity.c