diff options
| author | Josef Schlehofer <pepe.schlehofer@gmail.com> | 2026-11-05 08:27:08 +0100 |
|---|---|---|
| committer | Mikulas Patocka <mpatocka@redhat.com> | 2026-11-05 21:21:52 +0100 |
| commit | 6fed9e26810f0b466dbcebe35a73d1fd48793ff5 (patch) | |
| tree | 08041532aa348ce44160f5cf0fe1a4ecabf14d6e /rust/kernel/alloc/kvec | |
| parent | ae5b40accbc06f93e6a513e0e9a07fd32b197e49 (diff) | |
dm-crypt: defer async write submission to write thread
With no_write_workqueue, kcryptd_crypt_write_io_submit() submits the
bio directly, even when called from kcryptd_async_done(). An async
cipher may run this callback in softirq or with BH disabled, where
submit_bio_noacct() must not be called because it can sleep.
Submit inline only when async is false. Async completions are sent to
the write thread, as is already done for submit_from_crypt_cpus. Use
the async flag rather than in_interrupt(), since callback context
depends on the cipher driver. Sync ciphers still submit inline.
Tested with cryptd in QEMU (x86_64 and arm64) with
CONFIG_DEBUG_ATOMIC_SLEEP, and on a P2020 running 6.18.55 without it.
In QEMU:
- 4k writes logging "sleeping function called from invalid context":
100/100 unpatched, 0/155 patched.
- nr_requests=4 on a loop device: 0/6 unpatched runs completed,
4/4 patched runs completed.
On the P2020, a warning in blk_mq_run_hw_queue() appeared in the
6th unpatched run and did not appear in 30 patched runs.
Fixes: 39d42fa96ba1 ("dm crypt: add flags to optionally bypass kcryptd workqueues")
Cc: stable@vger.kernel.org
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Diffstat (limited to 'rust/kernel/alloc/kvec')
0 files changed, 0 insertions, 0 deletions
