lkml.org 
[lkml]   [2025]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/6] dm-crypt: set atomic as false when calling crypt_convert() in kworker
Hi,

On Mon, Jan 20, 2025 at 8:18 AM Hou Tao <houtao@huaweicloud.com> wrote:
>
> From: Hou Tao <houtao1@huawei.com>
>
> Both kcryptd_crypt_write_continue() and kcryptd_crypt_read_continue()
> are running in the kworker context, it is OK to call cond_resched(),

yes, indeed

> Therefore, set atomic as false when invoking crypt_convert() under
> kworker context.
>
> Signed-off-by: Hou Tao <houtao1@huawei.com>

Maybe add Fixes: 8abec36d1274 ("dm crypt: do not wait for backlogged
crypto request completion in softirq")?

Reviewed-by: Ignat Korchagin <ignat@cloudflare.com>

> ---
> drivers/md/dm-crypt.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
> index 1ae2c71bb383b..424c8fc3f0ada 100644
> --- a/drivers/md/dm-crypt.c
> +++ b/drivers/md/dm-crypt.c
> @@ -2098,7 +2098,7 @@ static void kcryptd_crypt_write_continue(struct work_struct *work)
> wait_for_completion(&ctx->restart);
> reinit_completion(&ctx->restart);
>
> - r = crypt_convert(cc, &io->ctx, true, false);
> + r = crypt_convert(cc, &io->ctx, false, false);
> if (r)
> io->error = r;
> crypt_finished = atomic_dec_and_test(&ctx->cc_pending);
> @@ -2203,7 +2203,7 @@ static void kcryptd_crypt_read_continue(struct work_struct *work)
> wait_for_completion(&io->ctx.restart);
> reinit_completion(&io->ctx.restart);
>
> - r = crypt_convert(cc, &io->ctx, true, false);
> + r = crypt_convert(cc, &io->ctx, false, false);
> if (r)
> io->error = r;
>
> --
> 2.29.2
>

\
 
 \ /
  Last update: 2025-01-20 18:25    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog