diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2017-07-21 13:16:06 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2017-07-25 10:11:13 -0400 |
commit | aa03a91ffaefcffb397cddf88b97215b3eff726d (patch) | |
tree | 4a2626accb37dbad4c356e790dadcace46e57a53 /drivers/md/dm-integrity.c | |
parent | a7c3e62bdc71d33f75803115d44e3ee7dab3d811 (diff) | |
download | talos-op-linux-aa03a91ffaefcffb397cddf88b97215b3eff726d.tar.gz talos-op-linux-aa03a91ffaefcffb397cddf88b97215b3eff726d.zip |
dm integrity: WARN_ON if variables representing journal usage get out of sync
If this WARN_ON triggers it speaks to programmer error, and likely
implies corruption, but no released kernel should trigger it. This
WARN_ON serves to assist DM integrity developers as changes are
made/tested in the future.
BUG_ON is excessive for catching programmer error, if a user or
developer would like warnings to trigger a panic, they can enable that
via /proc/sys/kernel/panic_on_warn
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-integrity.c')
-rw-r--r-- | drivers/md/dm-integrity.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c index be3b6f42095c..a7a3708700c0 100644 --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -1729,6 +1729,8 @@ static void pad_uncommitted(struct dm_integrity_c *ic) wraparound_section(ic, &ic->free_section); ic->n_uncommitted_sections++; } + WARN_ON(ic->journal_sections * ic->journal_section_entries != + (ic->n_uncommitted_sections + ic->n_committed_sections) * ic->journal_section_entries + ic->free_sectors); } static void integrity_commit(struct work_struct *w) |