- Fix DM integrity's HMAC support to provide enhanced security of
  internal_hash and journal_mac capabilities.

- Various DM writecache fixes to address performance, fix table output
  to match what was provided at table creation, fix writing beyond end
  of device when shrinking underlying data device, and a couple other
  small cleanups.

- Add DM crypt support for using trusted keys.

- Fix deadlock when swapping to DM crypt device by throttling number
  of in-flight REQ_SWAP bios. Implemented in DM core so that other
  bio-based targets can opt-in by setting ti->limit_swap_bios.

- Fix various inverted logic bugs in the .iterate_devices callout
  functions that are used to assess if specific feature or capability
  is supported across all devices being combined/stacked by DM.

- Fix DM era target bugs that exposed users to lost writes or memory
  leaks.

- Add DM core support for passing through inline crypto support of
  underlying devices. Includes block/keyslot-manager changes that
  enable extending this support to DM.

- Various small fixes and cleanups (spelling fixes, front padding
  calculation cleanup, cleanup conditional zoned support in targets,
  etc).
dm: fix deadlock when swapping to encrypted device

The system would deadlock when swapping to a dm-crypt device. The reason
is that for each incoming write bio, dm-crypt allocates memory that holds
encrypted data. These excessive allocations exhaust all the memory and the
result is either deadlock or OOM trigger.

This patch limits the number of in-flight swap bios, so that the memory
consumed by dm-crypt is limited. The limit is enforced if the target set
the "limit_swap_bios" variable and if the bio has REQ_SWAP set.

Non-swap bios are not affected becuase taking the semaphore would cause
performance degradation.

This is similar to request-based drivers - they will also block when the
number of requests is over the limit.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
4 files changed