1. 27 3月, 2021 2 次提交
  2. 23 3月, 2021 1 次提交
  3. 11 2月, 2021 2 次提交
    • M
      dm: fix deadlock when swapping to encrypted device · a666e5c0
      Mikulas Patocka 提交于
      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: NMikulas Patocka <mpatocka@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      a666e5c0
    • S
      dm: add support for passing through inline crypto support · aa6ce87a
      Satya Tangirala 提交于
      Update the device-mapper core to support exposing the inline crypto
      support of the underlying device(s) through the device-mapper device.
      
      This works by creating a "passthrough keyslot manager" for the dm
      device, which declares support for encryption settings which all
      underlying devices support.  When a supported setting is used, the bio
      cloning code handles cloning the crypto context to the bios for all the
      underlying devices.  When an unsupported setting is used, the blk-crypto
      fallback is used as usual.
      
      Crypto support on each underlying device is ignored unless the
      corresponding dm target opts into exposing it.  This is needed because
      for inline crypto to semantically operate on the original bio, the data
      must not be transformed by the dm target.  Thus, targets like dm-linear
      can expose crypto support of the underlying device, but targets like
      dm-crypt can't.  (dm-crypt could use inline crypto itself, though.)
      
      A DM device's table can only be changed if the "new" inline encryption
      capabilities are a (*not* necessarily strict) superset of the "old" inline
      encryption capabilities.  Attempts to make changes to the table that result
      in some inline encryption capability becoming no longer supported will be
      rejected.
      
      For the sake of clarity, key eviction from underlying devices will be
      handled in a future patch.
      Co-developed-by: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NSatya Tangirala <satyat@google.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      aa6ce87a
  4. 09 2月, 2021 1 次提交
  5. 03 2月, 2021 1 次提交
  6. 25 1月, 2021 1 次提交
  7. 09 1月, 2021 1 次提交
  8. 05 12月, 2020 6 次提交
  9. 02 12月, 2020 7 次提交
  10. 16 11月, 2020 2 次提交
  11. 08 10月, 2020 2 次提交
  12. 06 10月, 2020 1 次提交
  13. 02 10月, 2020 2 次提交
  14. 01 10月, 2020 1 次提交
    • M
      dm: fix missing imposition of queue_limits from dm_wq_work() thread · 0c2915b8
      Mike Snitzer 提交于
      If a DM device was suspended when bios were issued to it, those bios
      would be deferred using queue_io(). Once the DM device was resumed
      dm_process_bio() could be called by dm_wq_work() for original bio that
      still needs splitting. dm_process_bio()'s check for current->bio_list
      (meaning call chain is within ->submit_bio) as a prerequisite for
      calling blk_queue_split() for "abnormal IO" would result in
      dm_process_bio() never imposing corresponding queue_limits
      (e.g. discard_granularity, discard_max_bytes, etc).
      
      Fix this by always having dm_wq_work() resubmit deferred bios using
      submit_bio_noacct().
      
      Side-effect is blk_queue_split() is always called for "abnormal IO" from
      ->submit_bio, be it from application thread or dm_wq_work() workqueue,
      so proper bio splitting and depth-first bio submission is performed.
      For sake of clarity, remove current->bio_list check before call to
      blk_queue_split().
      
      Also, remove dm_wq_work()'s use of dm_{get,put}_live_table() -- no
      longer needed since IO will be reissued in terms of ->submit_bio.
      And rename bio variable from 'c' to 'bio'.
      
      Fixes: cf9c3786 ("dm: fix comment in dm_process_bio()")
      Reported-by: NJeffle Xu <jefflexu@linux.alibaba.com>
      Reviewed-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      0c2915b8
  15. 30 9月, 2020 7 次提交
  16. 25 9月, 2020 1 次提交
  17. 22 9月, 2020 2 次提交
    • M
      dm: fix comment in dm_process_bio() · cf9c3786
      Mike Snitzer 提交于
      Refer to the correct function (->submit_bio instead of ->queue_bio).
      Also, add details about why using blk_queue_split() isn't needed for
      dm_wq_work()'s call to dm_process_bio().
      
      Fixes: c62b37d9 ("block: move ->make_request_fn to struct block_device_operations")
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      cf9c3786
    • M
      dm: fix bio splitting and its bio completion order for regular IO · ee1dfad5
      Mike Snitzer 提交于
      dm_queue_split() is removed because __split_and_process_bio() _must_
      handle splitting bios to ensure proper bio submission and completion
      ordering as a bio is split.
      
      Otherwise, multiple recursive calls to ->submit_bio will cause multiple
      split bios to be allocated from the same ->bio_split mempool at the same
      time. This would result in deadlock in low memory conditions because no
      progress could be made (only one bio is available in ->bio_split
      mempool).
      
      This fix has been verified to still fix the loss of performance, due
      to excess splitting, that commit 120c9257 provided.
      
      Fixes: 120c9257 ("Revert "dm: always call blk_queue_split() in dm_process_bio()"")
      Cc: stable@vger.kernel.org # 5.0+, requires custom backport due to 5.9 changes
      Reported-by: NMing Lei <ming.lei@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      ee1dfad5