Re: [PATCH] dm-crypt: defer async write submission to write thread
From: Damien Le Moal
Date: Wed Nov 11 2026 - 04:04:28 EST
On 2026/11/10 13:29, Josef Schlehofer wrote:
> On Mon, 9 Nov 2026, Mikulas Patocka wrote:
>> On Mon, 9 Nov 2026, Damien Le Moal wrote:
>>> Originally, this was added to avoid write reordering for zoned block devices.
>>> So did you test this change with that (scsi_debug or null-blk) ? You can also
>>> use an emulated NVMe ZNS device in QEMU.
>>
>> So, should we disable asynchronous crypto operations for zoned devices?
>
> I tested dm-7.4 with and without the patch in QEMU, using null_blk,
> scsi_debug and an emulated ZNS device. I tested both cryptd and a
> synchronous cipher.
>
> My write and read-back checks passed on both arm64 and x86_64. I also
> ran fio's t/zbd suite and blktests zbd on arm64. All tests passed with
> both kernels.
My bad. Since we switched the block layer to zone write plugging, a DM device
only ever sees a single write command per zone. So regardless of what the target
driver does with that command, things are fine for writes to zoned block
devices. The only gotcha here is that if the target driver splits the write,
then the fragments must be ordered correctly to be sequential. If I remember
correctly, I patched dm-crypt to avoid such splitting for exactly that reason.
>
> I also used a kprobe to check whether async=1 was ever used in
> kcryptd_crypt_write_io_submit() on zoned devices. It wasn't, since
> DM_CRYPT_WRITE_INLINE keeps those writes on the async=0 path.
>
> The only exception was blktests zbd/013, which stalled during cleanup on
> both kernels under heavy host load. The LUKS volume was still mapped
> after luksClose, causing null_blk unloading to wait.
>
> I couldn't find any issues with this change or with async crypto on
> zoned devices, so whether to disable it is up to you and Damien.
Thanks for checking. async is fine for zoned devices. Feel free to focus on
other comments that mention that this may enable async even if the user does not
want that.
--
Damien Le Moal
Western Digital Research